-
-
Notifications
You must be signed in to change notification settings - Fork 475
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
users.users.<name>.shell
does not update the user's shell
#811
Comments
Closing as duplicate of #122 |
users.users.<name>.shell
does not update the user's shell
This looks to me like a separate to the one in #122 |
@bestlem I am not even sure they are related anymore: even after manually changing my shell on my machine, the path issue was not fixed. |
@Samuel-Martineau That is our point they have always been two separate issues. The comment I referred to has confused them and should be ignored. That thread deals with what should be in fish's startup files/ Your issue is about how to set fish as the login shell. (I thought this had been raised before) |
What is the best way to resolve this for now? To set fish as the default login shell using nix? |
Has this been resolved? |
This should’ve been fixed by #818 |
So now, in theory, I would just need:
and it should "just work"? |
Yeah that should work, feel free to comment if it doesn’t work |
It definitely doesn't work for me. I see the correct location in |
Hoping to reopen this issue. It doesn't seem fixed for me. Steps to recreate:
Now from here, I am not really sure what I expect. However, opening up terminal is still zsh and |
I don't have the time to investigate and fix this now, I'll just leave some notes here for anyone who wants to test it out and make a PR I suspect it'll have something to do with this command nix-darwin/modules/users/default.nix Line 175 in cf297a8
Possibly |
@Enzime when I run the same command manually it works fine even if the shell is already set
I tried to to debug the path being set by adding an |
I think the only way that code doesn’t run is if your user’s uid doesn’t match the one set in nix-darwin (I think the default is 501), if that’s the case a warning should be emitted |
My user ID is 501 🤔
|
Can you test if the |
Yep, I did that and it works without restarting.
|
|
That's weird. In my case, this works just fine. Can you give it a shot @spcutrell ? system.activationScripts.setFishAsShell.text = ''
dscl . -create /Users/${user} UserShell /run/current-system/sw/bin/fish
''; |
Well... forget what I posted. It is working now. I thought I was pretty thorough, but I'm going to chalk this up to user error for now. The |
I figured it out (at least for my own setup). As I mentioned earlier, the activation script doesn't run at all since I don't see logs e.g setting up users Looking at the script, it's behind a condition users.knownUsers = [ user ];
users.users.${user}.uid = 501; # or whatever your user id is And boom! I now see the logs and the shell is correctly set up 🎉 Edit: I think nix-darwin should warn users if the list of |
Confirming that it works for me as well. I'm not sure what mac views as "admin", but is there any concern about this from the docs? users.knownUsers |
I'm also not sure. My user is definitely an admin and I'd expect every other single-user setups to have the same issue. |
Well in any case, great work and thanks for your help. Not sure if this is expected behavior or how the maintainers would like to proceed, but it is pseudo-resolved imo. Side note: I decided I would learn Nix by just slowly building out a nix-darwin set-up, and my first goal was to get the shell changed from zsh... didn't realize I stepped into a trap! |
Funnily enough, I also stumbled across the same issue last year while building my nix-darwin/nixos setup. I made a home-manager script that calls Today, however, I was doing a major refactoring to my setup and and decided to check if the issue is still open 😄 |
I wasn't around when this option was created, so I don't know for sure, but my instinct is that that warning is there because letting nix-darwin manage your primary/admin user could potentially really screw up your system. I would strongly recommend not putting your user in |
It's not just about the shell though, most if not all of the options under |
Yes, I think the status quo is that you shouldn’t use the |
Coming from NixOS background that's quite the surprise frankly. I suggest making that more prominent in the official docs to avoid confusion |
We could maybe just remove the warning. It seems like the worry was that removing your user config would delete your user, but you can’t actually delete the currently logged‐in user anyway. |
I'd expect nix-darwin to manage the user if specified in |
This commit fixes the issue where settings `users.user.${user}.shell` wouldn't change default shell for the user. This was long running issue with `nix-darwin` and it's finally resolved upstream. [LnL7/nix-darwin#811][issuse] details how this was resolved. [issuse]: LnL7/nix-darwin#811
Fwiw I had the same problem, and it might be that for me this was somehow caused by homebrew installation of fish. Which, after uninstalling it, didn't clear the
|
Fixed in #1120 |
) - Move zsh config to `modules/shared/shells/zsh.nix`, add fish config to `modules/shared/shells/fish.nix` - Make each shell optional, add activeShell option definition in `shared/default.nix` for tracking the currently enabled shell. This is set in each shells/ file, then used in programs.nix to enable shell specific integrations with `isZsh` or `isFish` - Move `$EDITOR` definition to `shared/default.nix`, makes it global, instead of shell specific - Update `fileWidgetOptions` with conditional that uses fish syntax if using fish, else bash - Use `knownUsers` with `uid` to enable nix managed shell in nix-darwin - Note: `knownUsers` may not be the best way to do this - LnL7/nix-darwin#811 (comment)
For example, setting this in
~/.config/nix-darwin/flake.nix
still requires runningchsh -s /run/current-system/sw/bin/fish
.Also, should setting
users.users.<name>.shell
automatically add the shell toenvironment.shells
?The text was updated successfully, but these errors were encountered: