2020-07-24 17:15:55 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.nushell;
|
|
|
|
|
2021-03-13 05:20:00 +01:00
|
|
|
tomlFormat = pkgs.formats.toml { };
|
2020-07-24 17:15:55 +02:00
|
|
|
|
|
|
|
in {
|
|
|
|
meta.maintainers = [ maintainers.Philipp-M ];
|
|
|
|
|
|
|
|
options.programs.nushell = {
|
|
|
|
enable = mkEnableOption "nushell";
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.nushell;
|
2021-10-09 11:14:08 +02:00
|
|
|
defaultText = literalExpression "pkgs.nushell";
|
2020-07-24 17:15:55 +02:00
|
|
|
description = "The package to use for nushell.";
|
|
|
|
};
|
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = with types;
|
|
|
|
let
|
|
|
|
prim = oneOf [ bool int str ];
|
|
|
|
primOrPrimAttrs = either prim (attrsOf prim);
|
|
|
|
entry = either prim (listOf primOrPrimAttrs);
|
|
|
|
entryOrAttrsOf = t: either entry (attrsOf t);
|
|
|
|
entries = entryOrAttrsOf (entryOrAttrsOf entry);
|
|
|
|
in attrsOf entries // { description = "Nushell configuration"; };
|
|
|
|
default = { };
|
2021-10-09 11:14:08 +02:00
|
|
|
example = literalExpression ''
|
2020-07-24 17:15:55 +02:00
|
|
|
{
|
|
|
|
edit_mode = "vi";
|
|
|
|
startup = [ "alias la [] { ls -a }" "alias e [msg] { echo $msg }" ];
|
|
|
|
key_timeout = 10;
|
|
|
|
completion_mode = "circular";
|
|
|
|
no_auto_pivot = true;
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
Configuration written to
|
|
|
|
<filename>~/.config/nushell/config.toml</filename>.
|
|
|
|
</para><para>
|
2021-01-02 03:35:43 +01:00
|
|
|
See <link xlink:href="https://www.nushell.sh/book/configuration.html" /> for the full list
|
2020-07-24 17:15:55 +02:00
|
|
|
of options.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
2021-03-13 05:20:00 +01:00
|
|
|
xdg.configFile."nu/config.toml" = mkIf (cfg.settings != { }) {
|
|
|
|
source = tomlFormat.generate "nushell-config" cfg.settings;
|
|
|
|
};
|
2020-07-24 17:15:55 +02:00
|
|
|
};
|
|
|
|
}
|