diff options
| author | outremonde <outremonde@vivaldi.net> | 2025-06-10 20:32:00 -0400 |
|---|---|---|
| committer | outremonde <outremonde@vivaldi.net> | 2025-06-10 20:32:00 -0400 |
| commit | 9786eb8672213344d8d1b7bdef12bc94510b20db (patch) | |
| tree | b7d79440800c92d32187ab32c636b0830c94a610 /features/user/cli/shells/nushell/default.nix | |
initialized repository
Former-commit-id: 84647f22b951a957b2b83885b612115d473f6626
Diffstat (limited to 'features/user/cli/shells/nushell/default.nix')
| -rw-r--r-- | features/user/cli/shells/nushell/default.nix | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/features/user/cli/shells/nushell/default.nix b/features/user/cli/shells/nushell/default.nix new file mode 100644 index 0000000..7df34e8 --- /dev/null +++ b/features/user/cli/shells/nushell/default.nix @@ -0,0 +1,93 @@ +{ + config, + pkgs, + lib, + ... +}: let + cfg = config.features.cli.shells.nushell; +in { + options.features.cli.shells.nushell.enable = lib.mkEnableOption "nushell"; + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + television + gitprompt-rs + ]; + programs.nushell = { + enable = true; + plugins = with pkgs.nushellPlugins; [ + gstat + ]; + shellAliases = { + "nix-shell" = "nix-shell --command 'SHELL=nu nu'"; + "cd" = "z"; + "ze" = "zellij"; + "bk" = "cd $env.OLDPWD"; + "fg" = "job unfreeze"; + }; + configFile.text = + /* + nu + */ + '' + # Source modularized configs. + source ${./prompt.nu} + source ${./completion.nu} + + # General Config + $env.config = { + show_banner: false + edit_mode: 'vi' + + history: { + isolation: true # Isolate the history of each nushell session + file_format: sqlite # Required for isolation + } + } + $env.editor = "hx" + + # go should use a hidden directory + $env.gopath = "${config.home.homeDirectory}/.go" + + # Use direnv if present. + { || + if (which direnv | is-empty) { + return + } + direnv export json | from json | default {} | load-env + + } + + # define a function to initialize a direnv project + def projinit [path?: string] { + mut path = $path + if ($path == null) { + $path = "./" + } + let path = $path | path expand + cp -r ${./direnv-project-template}/* ./ + direnv allow + } + + # Quicker nix shells. + def qs [...pkgs] { + if $pkgs == [] { + print "Please use a package name" + return + } + let pkgs_string = $pkgs + | each {|pkg| return $"nixpkgs#($pkg) "} + | str join + | str trim + nu -c $"nix shell ($pkgs_string)" + } + ''; + }; + programs.zoxide.enable = true; + programs.carapace.enable = true; + programs.direnv = { + enable = true; + nix-direnv.enable = true; + silent = true; + }; + }; +} |
