Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: PATH includes /etc/profiles/per-user//bin (missing username) #3341

Closed
2 tasks done
n8henrie opened this issue Oct 18, 2022 · 2 comments
Closed
2 tasks done

bug: PATH includes /etc/profiles/per-user//bin (missing username) #3341

n8henrie opened this issue Oct 18, 2022 · 2 comments
Assignees
Labels
bug triage Issues or feature request that have not been triaged yet

Comments

@n8henrie
Copy link
Contributor

n8henrie commented Oct 18, 2022

Are you following the right branch?

  • My Nixpkgs and Home Manager versions are in sync

Is there an existing issue for this?

  • I have searched the existing issues

Issue description

I have home-manager.useUserPackages = true;, and I haven't changed this.

Inconsistently, I find that I'm missing packages that I have installed in my home-manager programs. Currently, I have neovim enabled and configured, but

$ nvim
The program 'nvim' is currently not installed. It is provided by
...

I can see that it's being installed:

$ ls /etc/profiles/per-user/$USER/bin/nvim
/etc/profiles/per-user/n8henrie/bin/nvim

When I investigate my $PATH, for some reason the /etc/profiles/per-user is missing my username:

$ printf "${PATH//:/'\n'}\n" | grep -e nix -e profile
/Users/n8henrie/.nix-profile/bin
/etc/profiles/per-user//bin
/nix/var/nix/profiles/default/bin

Any ideas what's going on?

Using as a nix-darwin module, flakes. It seems like this problem has happened to me and spontaneously(?) resolved 3 or 4 times now, I can't figure out what's going on.

Maintainer CC

No response

System information

 - system: `"aarch64-darwin"`
 - host os: `Darwin 21.6.0, macOS 12.6`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.11.0`
 - channels(n8henrie): `""`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
@n8henrie n8henrie added bug triage Issues or feature request that have not been triaged yet labels Oct 18, 2022
@n8henrie
Copy link
Contributor Author

$ nix eval ~/.dotfiles?submodules=1#darwinConfigurations.NatePro.config.home-manager.users.n8henrie.home.profileDirectory
"/etc/profiles/per-user/n8henrie"

So profileDirectory is being set correctly.

@n8henrie
Copy link
Contributor Author

User error.

Part of my bashrc explicitly sets my PATH with a hack1:

NIXPATH=$(
  # shellcheck disable=SC2016
  env -i HOME="${HOME}" sh -c '
      for f in /etc/static/bashrc /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh; do
        [ -f "${f}" ] && . "${f}"
      done
      echo "${PATH}"
    '
)

PATH=${NIXPATH}:${PATH}

I needed to change it to env -i HOME="${HOME}" USER="${USER}" so that $USER would be available when setting up my environment.

Footnotes

  1. See also: https://github.com/NixOS/nix/issues/5950, https://github.com/NixOS/nix/issues/5298

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Issues or feature request that have not been triaged yet
Projects
None yet
Development

No branches or pull requests

4 participants