nix-darwin icon indicating copy to clipboard operation
nix-darwin copied to clipboard

What does loginShell do?

Open pecigonzalo opened this issue 4 years ago • 1 comments

Inspecting the code, I could not find what loginShell is used for except for tmux. For context, I'm trying to make macOS load the nix-darwin zsh instead of the system one, with an existing user (not created through nix-darwin).

I have tried:

  programs.zsh = {
    enable = true;
  };
  environment.variables = {
    SHELL = "${pkgs.zsh}/bin/zsh";
  };
  environment.loginShell = "${pkgs.zsh}/bin/zsh -l";

The only way to make it work is to either chsh or something like whats done in dscl . -create '/Users/${v.name}' UserShell '${v.shell}'. I think it would be great if https://github.com/LnL7/nix-darwin/blob/master/modules/users/default.nix#L152-L168 did set the shell even if the user already exists.

pecigonzalo avatar Sep 22 '21 18:09 pecigonzalo

The only reference I see to environment.loginShell right now is programs.tmux.defaultCommand uses it. It is rather surprising how there is something called environment.loginShell that doesn't actually affect your overall environment, and only affects tmux (and isn't even doing that very well, it should be overriding the default-shell config value, not default-command).

Given this, I'd suggest that environment.loginShell should ideally be deleted entirely (and let tmux just have the default behavior, which means it'll inherit the user's shell; it can expose a defaultShell option instead to let people override default-shell if they're going to use tmux as their login shell). Granted, this is a compatibility hazard if anyone is using it in their local setup, so instead we could deprecate it, and update the description to explain that it doesn't really affect anything.

lilyball avatar Oct 25 '21 23:10 lilyball

Any update to this? I assumed this option would do something like chsh for me which is incorrect. This is quite misleading.

PhotonQuantum avatar Sep 30 '22 10:09 PhotonQuantum

Also see #328

The documentation is extremely misleading,

bestlem avatar Jan 23 '23 10:01 bestlem