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

Recent update seems to introduce issue with shell check and home-manager on macOS? #126

Open
victorhooi opened this issue Nov 19, 2024 · 1 comment

Comments

@victorhooi
Copy link
Contributor

I recently ran a nix flake update, followed by a nix run ./#build-switch - and I now seem to be getting an NixOS error regarding the shell configuration?

❯ nix run ./#build-switch
warning: Git tree '/Users/foobar/nixos-config' is dirty
Running build-switch for aarch64-darwin
Starting build...
warning: Git tree '/Users/foobar/nixos-config' is dirty
error:
       … while evaluating the attribute 'value'
         at /nix/store/hfz1qqd0z8amlgn8qwich1dvkmldik36-source/lib/modules.nix:816:9:
          815|     in warnDeprecation opt //
          816|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          817|         inherit (res.defsFinal') highestPrio;

       … while calling the 'addErrorContext' builtin
         at /nix/store/hfz1qqd0z8amlgn8qwich1dvkmldik36-source/lib/modules.nix:816:17:
          815|     in warnDeprecation opt //
          816|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |                 ^
          817|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error:
       Failed assertions:
       - users.users.foobar.shell is set to fish, but
       programs.fish.enable is not true. This will cause the fish
       shell to lack the basic Nix directories in its PATH and might make
       logging in as that user impossible. You can fix it with:
       programs.fish.enable = true;

       If you know what you're doing and you are fine with the behavior,
       set users.users.foobar.ignoreShellProgramCheck = true;
       instead.

I do have the following in modules/shared/home-manager.nix:

 40   fish = {
 41     enable = true;
 42 #    loginShellInit = ''
 43 #      if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish ]]; then
 44 #        source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish
 45 #        source /nix/var/nix/profiles/default/etc/profile.d/nix.fish
 46 #      fi
 47 #   '';
 48   };

However, it seems like NixOS itself might not be aware of the home-manager module?

NixOS/nixpkgs#280726

I'm pretty confused here as to the best way to fix this - is there some other place I should be setting fish.enable = true, on top of within home-manager.nix?

@tacomilkshake
Copy link

tacomilkshake commented Nov 25, 2024

I just set this repo up today on a new Mac and was hoping to get Fish, my preferred shell, working.

Unfortunately, I've been unable to do so with this repo. My existing (private) nix-config repo has Fish working just fine, so I couldn't say why it's not working in this one. I've tried just about every combination of config I can, and zsh always shows up.

FWIW, you can make this error go away by adding:
programs.fish.enable = true;
to modules/darwin/home-manager.nix

Despite the error going away, the shell remains zsh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants