nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.92k stars 1.8k forks source link

bug: mercurial via home-manager within nix-darwin is not reading the ~/.config/hg config files #5943

Open fredcy opened 1 week ago

fredcy commented 1 week ago

Are you following the right branch?

Is there an existing issue for this?

Issue description

Describe the bug

When I enable and configure the "mercurial" package via home-manager (within nix-darwin), the generated config files in ~/.config/hg are not read by the hg executable and so they do not take effect as needed.

Steps To Reproduce

Using home-manager (25.05) within nix-darwin (nixpgks 24.05), enable the mercurial package:

 programs.mercurial = {
    enable = true;
    userName = "Joe Schoe";
    userEmail = "joe@example.com";
};

Build the nix-darwin flake (with included home-manager module): darwin-rebuild switch --flake .

Verify that the generated ~/.config/hg/hgrc file includes username=Joe Schmoe <joe@example.com>.

Verify that hg picks up the generated configuration: hg config ui.username

Verify that hg is looking in the generated ~/.config/hg/hgrc file: hg --debug ui.username

Expected behavior

I expect the first hg command to report the user name/email value that we set, like this:

% hg config ui.username
Joe Schmoe <joe@example.com>
%

Instead, it reports no value at all:

% hg config ui.username
%

I expect the output of hg --debug config ui.username to show that it is reading the ~/.config/hg/hgrc file among others, but it does not:

% hg --debug config ui.username
starting pager for command 'config'
read config from: resource:mercurial.defaultrc.mergetools.rc
read config from: /nix/store/n5apv7svzvka6i0xc40m7lk6yrdk2yvp-mercurial-6.6.3/etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc
read config from: /Users/joe/.hgrc

(The /nix/store/n5apv7svzvka6i0xc40m7lk6yrdk2yvp-mercurial-6.6.3/etc/mercurial/hgrc path is "no such file or directory")

Additional context

I have used the same mercurial home-manager config on a linux system (with just nixpkgs, not nixos) and it works fine there, reading the hg config files in ~/.config/hg.

Maintainer CC

No response

System information

warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.6.0, macOS 14.6.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.18.8`
 - nixpkgs: `/nix/store/mrpfclqc430y8gc7xs3rrp59cjk1pc9b-source`
fredcy commented 1 week ago

I first tried reporting this issue at https://github.com/NixOS/nixpkgs/issues/346194, but they told me to come here.