mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
nushell: allow installing plugins
When the version of Nushell or any Nushell plugin changes, the plugin registry must be regenerated.
This commit is contained in:
parent
e952e94955
commit
8772bae58c
3 changed files with 38 additions and 3 deletions
|
@ -1890,6 +1890,15 @@ in {
|
||||||
NOTE: The minus symbol means to NOT use that particular TLS version.
|
NOTE: The minus symbol means to NOT use that particular TLS version.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2024-12-10T22:20:10+00:00";
|
||||||
|
condition = config.programs.nushell.enable;
|
||||||
|
message = ''
|
||||||
|
The module 'programs.nushell' can now manage the Nushell plugin
|
||||||
|
registry with the option 'programs.nushell.plugins'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,8 @@ let
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
meta.maintainers = [ maintainers.Philipp-M maintainers.joaquintrinanes ];
|
meta.maintainers =
|
||||||
|
[ maintainers.Philipp-M maintainers.joaquintrinanes maintainers.aidalgol ];
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
(mkRemovedOptionModule [ "programs" "nushell" "settings" ] ''
|
(mkRemovedOptionModule [ "programs" "nushell" "settings" ] ''
|
||||||
|
@ -134,6 +135,15 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugins = mkOption {
|
||||||
|
type = types.listOf types.package;
|
||||||
|
default = [ ];
|
||||||
|
example = lib.literalExpression "[ pkgs.nushellPlugins.formats ]";
|
||||||
|
description = ''
|
||||||
|
A list of nushell plugins to write to the plugin registry file.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
shellAliases = mkOption {
|
shellAliases = mkOption {
|
||||||
type = types.attrsOf types.str;
|
type = types.attrsOf types.str;
|
||||||
default = { };
|
default = { };
|
||||||
|
@ -203,6 +213,20 @@ in {
|
||||||
cfg.extraLogin
|
cfg.extraLogin
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(let
|
||||||
|
msgPackz = pkgs.runCommand "nushellMsgPackz" { } ''
|
||||||
|
mkdir -p "$out"
|
||||||
|
${lib.getExe cfg.package} \
|
||||||
|
--plugin-config "$out/plugin.msgpackz" \
|
||||||
|
--commands '${
|
||||||
|
concatStringsSep "; "
|
||||||
|
(map (plugin: "plugin add ${lib.getExe plugin}") cfg.plugins)
|
||||||
|
}'
|
||||||
|
'';
|
||||||
|
in mkIf (cfg.plugins != [ ]) {
|
||||||
|
"${configDir}/plugin.msgpackz".source = "${msgPackz}/plugin.msgpackz";
|
||||||
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
plugins = [ pkgs.nushellPlugins.formats ];
|
||||||
|
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
"lsname" = "(ls | get name)";
|
"lsname" = "(ls | get name)";
|
||||||
"ll" = "ls -a";
|
"ll" = "ls -a";
|
||||||
|
@ -41,8 +43,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
test.stubs.nushell = { };
|
|
||||||
|
|
||||||
nmt.script = let
|
nmt.script = let
|
||||||
configDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then
|
configDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then
|
||||||
"home-files/Library/Application Support/nushell"
|
"home-files/Library/Application Support/nushell"
|
||||||
|
@ -58,5 +58,7 @@
|
||||||
assertFileContent \
|
assertFileContent \
|
||||||
"${configDir}/login.nu" \
|
"${configDir}/login.nu" \
|
||||||
${./login-expected.nu}
|
${./login-expected.nu}
|
||||||
|
assertFileExists \
|
||||||
|
"${configDir}/plugin.msgpackz"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue