Just messing around with nu for the first time and set it as the default shell for Alacritty (I’m primarily using Terminal.app).
Unfortunately putting it as the default shell means that it isn’t inheriting PATH
, so none of my nix stuff works (it’s not sourcing /etc/bashrc
, which is where nix-darwin does its magic).
I’m sure I could do something like have my default shell be bash -lc nu
, but that seems a little unsatisfying.
Does anyone have a nu environment config that sets up nix path for darwin? TIA!
For the moment, I went with the following in my alacritty config:
programs.alacritty = {
enable = true;
settings = lib.optionalAttrs isDarwin {
shell.program = "${pkgs.unstable.zellij}/bin/zellij";
};
And this in my zellij config:
programs.zellij = {
enable = true;
settings = lib.optionalAttrs isDarwin {
default_shell = let
nuWithPath = pkgs.writeScriptBin "nu" ''
/usr/bin/env -i USER=$USER HOME=$HOME bash -c 'source /etc/bashrc; ${nushell}/bin/nu'
'';
in "${nuWithPath}/bin/nu";
copy_command = "pbcopy";
};
Startup time is still quite quick, and this allows me to run from Alacritty.app
and I have my nix path available.
Unfortunately the above approach made it so zellij was unable to maintain PWD when opening a new pane. As an alternative approach, I put the following in my home-manager config, which seems to work:
envFile.text = lib.optionalString (osConfig ? environment) ''
$env.PATH = ${builtins.replaceStrings
[
"$USER"
"$HOME"
]
[
config.home.username
config.home.homeDirectory
]
osConfig.environment.systemPath}
'';
osConfig
doesn’t exist in standalone home-manager installations, so I’m not sure how to get osConfig.environment.systemPath
in that case, but for my nix-darwin setup it seems to work and ensures that nu has access to my full nix path.