diff --git a/modules/programs/nushell.nix b/modules/programs/nushell.nix index 92a8f4e9..a4e767c8 100644 --- a/modules/programs/nushell.nix +++ b/modules/programs/nushell.nix @@ -164,7 +164,10 @@ in { shellAliases = lib.mkOption { type = types.attrsOf types.str; default = { }; - example = { ll = "ls -l"; }; + example = { + ll = "ls -l"; + g = "git"; + }; description = '' An attribute set that maps aliases (the top level attribute names in this option) to command strings or directly to build outputs. @@ -202,7 +205,8 @@ in { || aliasesStr != "" || cfg.settings != { }; aliasesStr = lib.concatLines - (lib.mapAttrsToList (k: v: "alias ${k} = ${v}") cfg.shellAliases); + (lib.mapAttrsToList (k: v: "alias ${toNushell { } k} = ${v}") + cfg.shellAliases); in lib.mkIf writeConfig { "${configDir}/config.nu".text = lib.mkMerge [ (let diff --git a/tests/modules/programs/nushell/config-expected.nu b/tests/modules/programs/nushell/config-expected.nu index 4578f953..57bc16ee 100644 --- a/tests/modules/programs/nushell/config-expected.nu +++ b/tests/modules/programs/nushell/config-expected.nu @@ -26,5 +26,6 @@ let config = { } -alias ll = ls -a -alias lsname = (ls | get name) +alias "ll" = ls -a +alias "multi word alias" = cd - +alias "z" = __zoxide_z diff --git a/tests/modules/programs/nushell/example-settings.nix b/tests/modules/programs/nushell/example-settings.nix index 598a7bd8..9f0108a3 100644 --- a/tests/modules/programs/nushell/example-settings.nix +++ b/tests/modules/programs/nushell/example-settings.nix @@ -26,8 +26,9 @@ plugins = [ pkgs.nushellPlugins.formats ]; shellAliases = { - "lsname" = "(ls | get name)"; "ll" = "ls -a"; + "multi word alias" = "cd -"; + "z" = "__zoxide_z"; }; settings = {