2025-01-31 21:24:47 +01:00
|
|
|
{ pkgs, realPkgs, config, lib, ... }:
|
2022-05-13 17:20:42 +02:00
|
|
|
|
2025-02-21 16:31:43 -06:00
|
|
|
{
|
2022-05-13 17:20:42 +02:00
|
|
|
programs.nushell = {
|
|
|
|
enable = true;
|
2025-01-31 21:24:47 +01:00
|
|
|
package = realPkgs.nushell;
|
2022-05-13 17:20:42 +02:00
|
|
|
|
|
|
|
configFile.text = ''
|
2024-12-08 01:00:45 +01:00
|
|
|
let config = {
|
2022-05-13 17:20:42 +02:00
|
|
|
filesize_metric: false
|
|
|
|
table_mode: rounded
|
|
|
|
use_ls_colors: true
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
|
|
|
envFile.text = ''
|
2023-08-02 01:27:30 +08:00
|
|
|
$env.FOO = 'BAR'
|
2022-05-13 17:20:42 +02:00
|
|
|
'';
|
2022-12-27 17:29:16 +01:00
|
|
|
|
2023-03-20 17:07:24 -04:00
|
|
|
loginFile.text = ''
|
|
|
|
# Prints "Hello, World" upon logging into tty1
|
|
|
|
if (tty) == "/dev/tty1" {
|
|
|
|
echo "Hello, World"
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2025-01-31 21:24:47 +01:00
|
|
|
plugins = [ realPkgs.nushellPlugins.formats ];
|
2024-12-07 16:23:14 +13:00
|
|
|
|
2022-12-27 17:29:16 +01:00
|
|
|
shellAliases = {
|
|
|
|
"ll" = "ls -a";
|
2025-01-05 13:39:08 +01:00
|
|
|
"multi word alias" = "cd -";
|
|
|
|
"z" = "__zoxide_z";
|
2022-12-27 17:29:16 +01:00
|
|
|
};
|
2023-05-03 18:12:21 -04:00
|
|
|
|
2024-12-08 01:00:45 +01:00
|
|
|
settings = {
|
|
|
|
show_banner = false;
|
|
|
|
display_errors.exit_code = false;
|
|
|
|
hooks.pre_execution =
|
|
|
|
[ (lib.hm.nushell.mkNushellInline ''{|| "pre_execution hook"}'') ];
|
|
|
|
};
|
|
|
|
|
2024-09-14 18:09:15 +02:00
|
|
|
environmentVariables = {
|
|
|
|
FOO = "BAR";
|
|
|
|
LIST_VALUE = [ "foo" "bar" ];
|
|
|
|
PROMPT_COMMAND = lib.hm.nushell.mkNushellInline ''{|| "> "}'';
|
|
|
|
ENV_CONVERSIONS.PATH = {
|
|
|
|
from_string =
|
|
|
|
lib.hm.nushell.mkNushellInline "{|s| $s | split row (char esep) }";
|
|
|
|
to_string =
|
|
|
|
lib.hm.nushell.mkNushellInline "{|v| $v | str join (char esep) }";
|
|
|
|
};
|
|
|
|
};
|
2022-05-13 17:20:42 +02:00
|
|
|
};
|
|
|
|
|
2022-11-23 15:37:08 -08:00
|
|
|
nmt.script = let
|
2024-04-14 08:58:16 +02:00
|
|
|
configDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then
|
2022-11-23 15:37:08 -08:00
|
|
|
"home-files/Library/Application Support/nushell"
|
|
|
|
else
|
|
|
|
"home-files/.config/nushell";
|
|
|
|
in ''
|
2022-05-13 17:20:42 +02:00
|
|
|
assertFileContent \
|
2022-11-23 15:37:08 -08:00
|
|
|
"${configDir}/config.nu" \
|
2022-05-13 17:20:42 +02:00
|
|
|
${./config-expected.nu}
|
|
|
|
assertFileContent \
|
2022-11-23 15:37:08 -08:00
|
|
|
"${configDir}/env.nu" \
|
2022-05-13 17:20:42 +02:00
|
|
|
${./env-expected.nu}
|
2023-03-20 17:07:24 -04:00
|
|
|
assertFileContent \
|
|
|
|
"${configDir}/login.nu" \
|
|
|
|
${./login-expected.nu}
|
2024-12-07 16:23:14 +13:00
|
|
|
assertFileExists \
|
|
|
|
"${configDir}/plugin.msgpackz"
|
2022-05-13 17:20:42 +02:00
|
|
|
'';
|
|
|
|
}
|