nushell: allow arbitrary environment variables

This commit is contained in:
Joaquín Triñanes 2024-09-14 18:09:15 +02:00 committed by Robert Helgesson
parent edf15f1549
commit 628b15d275
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
3 changed files with 47 additions and 9 deletions

View file

@ -1,4 +1,17 @@
$env.FOO = 'BAR'
$env.BAR = $'(echo BAZ)'
load-env {
"ENV_CONVERSIONS": {
"PATH": {
"from_string": ({|s| $s | split row (char esep) })
"to_string": ({|v| $v | str join (char esep) })
}
}
"FOO": "BAR"
"LIST_VALUE": [
"foo"
"bar"
]
"PROMPT_COMMAND": ({|| "> "})
}

View file

@ -1,4 +1,4 @@
{ pkgs, config, ... }:
{ pkgs, config, lib, ... }:
{
programs.nushell = {
@ -28,7 +28,17 @@
"ll" = "ls -a";
};
environmentVariables = { BAR = "$'(echo BAZ)'"; };
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) }";
};
};
};
test.stubs.nushell = { };