feat: add nushell integration config

This commit is contained in:
Zhongheng Liu 2024-12-07 19:22:53 +02:00
commit 583cdd7b00
Signed by: steven
GPG key ID: 805A28B071DAD84B
4 changed files with 46 additions and 2 deletions

View file

@ -10,6 +10,7 @@ in
imports = [
./zsh.nix
./fish
./nushell
./zoxide.nix
./direnv.nix
./starship
@ -22,8 +23,9 @@ in
config = {
myShells = {
zsh.enable = false;
fish.enable = true;
defaultShell = "fish";
fish.enable = false;
nushell.enable = true;
defaultShell = "${config.programs.nushell.package}/bin/nu";
prompts.starship.enable = true;
};
};

View file

@ -2,6 +2,7 @@
programs = {
direnv = {
enable = true;
enableNushellIntegration = true;
nix-direnv.enable = true;
};
};

View file

@ -0,0 +1,26 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.myShells.nushell;
in
with lib; {
options = {
myShells.nushell = {enable = mkEnableOption "Enables nushell config";};
};
config = mkIf cfg.enable {
programs = {
nushell = {
enable = true;
configFile.source = ./init/config.nu;
shellAliases = import ../aliases/default.nix {inherit pkgs;};
};
carapace = {
enable = true;
enableNushellIntegration = true;
};
};
};
}

View file

@ -0,0 +1,15 @@
$env.config = {
show_banner: false,
hooks: {
pre_prompt: [{ ||
if (which direnv | is-empty) {
return
}
direnv export json | from json | default {} | load-env
if 'ENV_CONVERSIONS' in $env and 'PATH' in $env.ENV_CONVERSIONS {
$env.PATH = do $env.ENV_CONVERSIONS.PATH.from_string $env.PATH
}
}]
}
}