1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2025-02-07 00:35:04 +01:00

nushell: allow multi-word aliases

Also fix invalid alias in test
This commit is contained in:
Joaquín Triñanes 2025-01-05 13:39:08 +01:00 committed by Robert Helgesson
parent 709aaab1a5
commit 82455a84e3
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
3 changed files with 11 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -26,8 +26,9 @@
plugins = [ pkgs.nushellPlugins.formats ];
shellAliases = {
"lsname" = "(ls | get name)";
"ll" = "ls -a";
"multi word alias" = "cd -";
"z" = "__zoxide_z";
};
settings = {