-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
49 lines (43 loc) · 1.41 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ config, specialArgs, pkgs, lib, ... }:
let
cfg = config.local.nushell;
inherit (lib) mkEnableOption mkIf;
inherit (specialArgs) flakePkgs;
in
{
options.local.nushell = {
enable = mkEnableOption "nushell";
left_prompt_cmd = lib.mkOption { default = "hostname -s"; type = lib.types.str; description = "Command to use to generate left prompt text"; };
history_file_format = lib.mkOption { default = "sqlite"; type = lib.types.str; description = "History file format, either sqlite or plaintext"; };
};
config = mkIf cfg.enable {
programs = {
nushell = {
enable = true;
configFile.text = (builtins.replaceStrings [
"HISTORY_FILE_FORMAT"
"NIX_BASH_ENV_NU_MODULE"
] [
config.local.nushell.history_file_format
"${flakePkgs.bash-env-nushell}/bash-env.nu"
]
(builtins.readFile ./config.nu));
envFile.text = ''
# Nushell Environment Config File
def create_left_prompt [] {
let hostname_color = (if (is-admin) { ansi red_bold } else { ansi green_bold })
$"($hostname_color)(${config.local.nushell.left_prompt_cmd})(ansi reset)"
}
'' + (builtins.readFile ./env.nu);
};
direnv.enableNushellIntegration = true;
};
home = {
packages = with pkgs; [
flakePkgs.bash-env-nushell
jc
job-security
];
};
};
}