LnL7 / nix-darwin

nix modules for darwin
MIT License
2.77k stars 429 forks source link

Nix-Darwin x HM doesn't install paths in for zsh `/run/current-system/sw/bin` #922

Closed Eveeifyeve closed 1 week ago

Eveeifyeve commented 5 months ago

The issue is when I install nix on my machine m2 Macbook pro 13inch it some how doesn't have this path exported which I need for darwin-rebuild for some reason only nix run nix-darwin -- switch --flake ~/.dotfiles/ seems to work.

PATH Echo Output

/Users/eveeifyeve/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/bin:/bin

List /run/current-system/sw/bin

bash            darwin-option       info            nix-build       nix-daemon      nix-instantiate     pdftexi2dvi     texi2dvi
bashbug         darwin-rebuild      install-info        nix-channel     nix-env         nix-prefetch-url    pod2texi        texi2pdf
brew            darwin-uninstaller  makeinfo        nix-collect-garbage nix-hash        nix-shell       sh          texindex
darwin-help     darwin-version      nix         nix-copy-closure    nix-info        nix-store       texi2any

Info

Eveeifyeve commented 5 months ago

I have tried both the distributed systems and nixos.org nix and still not working so it's not a nix problem.

Enzime commented 5 months ago

If you add programs.zsh.enable = true; does that fix it?

yswtrue commented 5 months ago

same here I have set programs.fish.enable = true;, but there is no in$PATH

 ~  echo $PATH                                                  21.3s  Sat Apr  6 03:34:06 2024
/nix/var/nix/profiles/default/bin /opt/homebrew/bin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
Eveeifyeve commented 5 months ago

If i add the programs.enabled.zsh it still doesn't work.

Eveeifyeve commented 5 months ago

I have discussed in both distributed systems and nix discord and told me it's a nix-darwin issue.

yswtrue commented 5 months ago

finally I install fish from nix-darwin

        environment.shells = [ pkgs.bashInteractive pkgs.zsh pkgs.fish ];

and then chsh to /run/current-system/sw/bin/fish than reboot fix this error, seams fish from brew can't read nix relate config

Eveeifyeve commented 5 months ago

I have tried a new fresh install of nix and removed all of the volumes and stuff and path is still not added I am going to try the enable zsh method.

Eveeifyeve commented 5 months ago

Okay It turns out I have to enable it with nix-darwin not hw.

I will make a pr that warns people about this.

ibizaman commented 5 months ago

Thank you @Eveeifyeve I was trying to debug this since a long time and found your comment. Now my path contains /run/current-system/sw/bin.

ibizaman commented 5 months ago

Looks like this issue is due to https://github.com/nix-community/home-manager/issues/2751

Eveeifyeve commented 5 months ago

Hey I want to do a check for one of the shell is enabled but I want ask where exactly the check be located? The check is for people who don't enabled any shell and that way it errors out if you haven't enabled it.

It will maybe close: #922 #122 #158. There maybe more that I don't know if there is reply to this with the #.

stringang commented 4 months ago

I also have the same problem.

bjeanes commented 2 months ago

If you add programs.zsh.enable = true; does that fix it?

I overlooked that setting programs.zsh.enable = true; in the home manager config was insufficient. I had to set this in both the HM portion of my flake and the darwin configuration.

Eveeifyeve commented 1 week ago

Closing this issue for now if you have issue enable both HM and nix-Darwin zsh and it should work.