Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions modules/programs/direnv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ in {
# Using mkAfter to make it more likely to appear after other
# manipulations of the prompt.
mkAfter ''
let-env config = ($env | default {} config).config
let-env config = ($env.config | default {} hooks)
let-env config = ($env.config | update hooks ($env.config.hooks | default [] pre_prompt))
let-env config = ($env.config | update hooks.pre_prompt ($env.config.hooks.pre_prompt | append {
$env.config = ($env | default {} config).config
$env.config = ($env.config | default {} hooks)
$env.config = ($env.config | update hooks ($env.config.hooks | default [] pre_prompt))
$env.config = ($env.config | update hooks.pre_prompt ($env.config.hooks.pre_prompt | append {
code: "
let direnv = (${pkgs.direnv}/bin/direnv export json | from json)
let direnv = if ($direnv | length) == 1 { $direnv } else { {} }
Expand Down
5 changes: 2 additions & 3 deletions modules/programs/nushell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ in {
type = types.nullOr (linesOrSource "env.nu");
default = null;
example = ''
let-env FOO = 'BAR'
$env.FOO = 'BAR'
'';
description = ''
The environment variables file to be used for nushell.
Expand Down Expand Up @@ -174,8 +174,7 @@ in {

(let
envVarsStr = concatStringsSep "\n"
(mapAttrsToList (k: v: "let-env ${k} = ${v}")
cfg.environmentVariables);
(mapAttrsToList (k: v: "$env.${k} = ${v}") cfg.environmentVariables);
in mkIf (cfg.envFile != null || cfg.extraEnv != "" || envVarsStr != "") {
"${configDir}/env.nu".text = mkMerge [
(mkIf (cfg.envFile != null) cfg.envFile.text)
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/programs/nushell/env-expected.nu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let-env FOO = 'BAR'
$env.FOO = 'BAR'


let-env BAR = $'(echo BAZ)'
$env.BAR = $'(echo BAZ)'
2 changes: 1 addition & 1 deletion tests/modules/programs/nushell/example-settings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'';

envFile.text = ''
let-env FOO = 'BAR'
$env.FOO = 'BAR'
'';

loginFile.text = ''
Expand Down