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
|
|
@ -39,7 +39,8 @@ let
|
|||
};
|
||||
});
|
||||
in {
|
||||
meta.maintainers = [ maintainers.Philipp-M maintainers.joaquintrinanes ];
|
||||
meta.maintainers =
|
||||
[ maintainers.Philipp-M maintainers.joaquintrinanes maintainers.aidalgol ];
|
||||
|
||||
imports = [
|
||||
(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 {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
|
|
@ -203,6 +213,20 @@ in {
|
|||
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";
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue