nix-darwin
nix-darwin copied to clipboard
Nix complains about $HOME being retained by sudo
Ever since this (https://github.com/NixOS/nix/pull/6676) change in nix, it checks that $HOME is owned by the current user.
When using darwin-rebuild, this check is tripped, causing a warning to be printed:
warning: $HOME ('/Users/jamie') is not owned by you, falling back to the one defined in the 'passwd' file.
As far as I can tell, this occurs during this invokation of nix-env: https://github.com/LnL7/nix-darwin/blob/54a24f042f93c79f5679f133faddedec61955cf2/pkgs/nix-tools/darwin-rebuild.sh#L181
This happens because nix-env
is executing as UID 0, however $HOME
still points to /Users/jamie
(sudo on macos does not clear $HOME
)
This does not appear to be actually causing any issues, but thought I'd report it here anyway, in case this is fixable from this end.
Ah, thanks for tracking this down. I was searching high and low where this was suddenly coming from! I've not noticed any bad side effects either.
I think I've got into some troubles due to that change. My account is not present in /etc/passwd file (I think is manages like NSS on linux) I get this warning and all applications seem to think that my home directory is located in /var/empty
is this possible?
all applications seem to think that my home directory is located in
/var/empty
is this possible?
ah, I noticed that too. I fixed it via:
users.users."joscha".home = "/Users/joscha";
but that's very possibly a side-effect of that warning.
Setting users.users.USER.home doesn't fix this for me. Just noticed this warning today after bumping nixpkgs. Nix-darwin with home-manager as a module.
I still face this issue,
warning: $HOME ('/Users/kkharji') is not owned by you, falling back to the one defined in the 'passwd' file ('/var/root')
Using nix flake, info
├───nix-darwin: github:lnl7/nix-darwin/6349b99bc2b96ded34d068a88c7c5ced406b7f7f
│ └───nixpkgs follows input 'nixpkgs'