nix-community / home-manager

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

bug: Packages in `home.packages` are not available to run noninteractively via SSH on standalone home-manager on macOS #5336

Open Samasaur1 opened 4 months ago

Samasaur1 commented 4 months ago

Are you following the right branch?

Is there an existing issue for this?

Issue description

Anything in home.packages is not available to run noninteractively via SSH. For example, with this home-manager config:

home.packages = [ pkgs.hello ];

I see the following behavior:

[sam] $ ssh server
[sam@server] $ hello
Hello, world!
[sam@server] $ exit
[sam] $ ssh server hello
bash: line 1: hello: command not found

I should be able to run ssh server hello and successfully see "Hello, world!"

This is only the case using standalone home-manager on macOS, not in any of the following cases:

In all three of these other cases, ssh server hello works correctly.

The issue is that packages in home.packages aren't added to my PATH for noninteractive shells. This is because everything in home.packages is added to PATH in /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh which is sourced in /etc/bashrc which had nothing to do with home-manager. So it seems like home-manager has been relying on some behavior from nixos and nix-darwin (I actually can't track down where home.packages gets added to my PATH when using home-manager as a nix-darwin module).

Maintainer CC

No response

System information

- system: `"x86_64-darwin"`
 - host os: `Darwin 21.6.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.20.5`
 - nixpkgs: `/nix/store/0vyi8f8l8cya10dmgfrj0df2iqxlhiyi-source`
stale[bot] commented 1 month ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.