From b319f195911d653e4c2a6c1aee6fb8130a2fe996 Mon Sep 17 00:00:00 2001 From: ljyoth Date: Thu, 23 Jan 2025 20:57:08 -0500 Subject: [PATCH] mise: enable nushell integration --- modules/programs/mise.nix | 15 +++++++++++++ tests/modules/programs/mise/default.nix | 1 + .../programs/mise/nushell-integration.nix | 21 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 tests/modules/programs/mise/nushell-integration.nix diff --git a/modules/programs/mise.nix b/modules/programs/mise.nix index 404f1bf9c..521f7c591 100644 --- a/modules/programs/mise.nix +++ b/modules/programs/mise.nix @@ -21,6 +21,7 @@ in { "enableBashIntegration" "enableZshIntegration" "enableFishIntegration" + "enableNushellIntegration" "settings" ]; @@ -42,6 +43,10 @@ in { default = true; }; + enableNushellIntegration = mkEnableOption "Nushell Integration" // { + default = true; + }; + globalConfig = mkOption { type = tomlFormat.type; default = { }; @@ -106,6 +111,16 @@ in { fish.interactiveShellInit = mkIf cfg.enableFishIntegration '' ${getExe cfg.package} activate fish | source ''; + + nushell = mkIf cfg.enableNushellIntegration { + extraEnv = '' + let mise_path = $nu.default-config-dir | path join mise.nu + ^mise activate nu | save $mise_path --force + ''; + extraConfig = '' + use ($nu.default-config-dir | path join mise.nu) + ''; + }; }; }; } diff --git a/tests/modules/programs/mise/default.nix b/tests/modules/programs/mise/default.nix index 511082a12..402e32639 100644 --- a/tests/modules/programs/mise/default.nix +++ b/tests/modules/programs/mise/default.nix @@ -4,4 +4,5 @@ mise-bash-integration = ./bash-integration.nix; mise-zsh-integration = ./zsh-integration.nix; mise-fish-integration = ./fish-integration.nix; + mise-nushell-integration = ./nushell-integration.nix; } diff --git a/tests/modules/programs/mise/nushell-integration.nix b/tests/modules/programs/mise/nushell-integration.nix new file mode 100644 index 000000000..926df987e --- /dev/null +++ b/tests/modules/programs/mise/nushell-integration.nix @@ -0,0 +1,21 @@ +{ config, ... }: { + programs = { + mise = { + package = config.lib.test.mkStubPackage { name = "mise"; }; + enable = true; + enableNushellIntegration = true; + }; + + nushell.enable = true; + }; + + nmt.script = '' + assertFileContains home-files/.config/nushell/env.nu \ + ' + let mise_path = $nu.default-config-dir | path join mise.nu + ^mise activate nu | save $mise_path --force + ' + assertFileContains home-files/.config/nushell/config.nu \ + 'use ($nu.default-config-dir | path join mise.nu)' + ''; +}