nushell: add login.nu configuration option
Nushell has the option to source from the login.nu file in the case that nushell is used as a login shell. This commit adds the login file alongside the existing config and env files as another configuration option.
This commit is contained in:
parent
24805d3ca7
commit
e15010ee6e
3 changed files with 46 additions and 0 deletions
|
|
@ -96,6 +96,23 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
loginFile = mkOption {
|
||||
type = types.nullOr (linesOrSource "login.nu");
|
||||
default = null;
|
||||
example = ''
|
||||
# Prints "Hello, World" upon logging into tty1
|
||||
if (tty) == "/dev/tty1" {
|
||||
echo "Hello, World"
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
The login file to be used for nushell upon logging in.
|
||||
</para>
|
||||
<para>
|
||||
See <link xlink:href="https://www.nushell.sh/book/configuration.html#configuring-nu-as-a-login-shell" /> for more information.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
|
|
@ -112,6 +129,14 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
extraLogin = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Additional configuration to add to the nushell login file.
|
||||
'';
|
||||
};
|
||||
|
||||
shellAliases = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
|
|
@ -161,6 +186,12 @@ in {
|
|||
envVarsStr
|
||||
];
|
||||
})
|
||||
(mkIf (cfg.loginFile != null || cfg.extraLogin != "") {
|
||||
"${configDir}/login.nu".text = mkMerge [
|
||||
(mkIf (cfg.loginFile != null) cfg.loginFile.text)
|
||||
cfg.extraLogin
|
||||
];
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue