1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-02 21:13:33 +02:00

nushell: deprecation of let-env (#4292)

This commit is contained in:
Yt 2023-08-02 01:27:30 +08:00 committed by GitHub
parent 4542db6056
commit 8c731978f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 10 deletions

View File

@ -128,10 +128,10 @@ in {
# Using mkAfter to make it more likely to appear after other # Using mkAfter to make it more likely to appear after other
# manipulations of the prompt. # manipulations of the prompt.
mkAfter '' mkAfter ''
let-env config = ($env | default {} config).config $env.config = ($env | default {} config).config
let-env config = ($env.config | default {} hooks) $env.config = ($env.config | default {} hooks)
let-env config = ($env.config | update hooks ($env.config.hooks | default [] pre_prompt)) $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.config | update hooks.pre_prompt ($env.config.hooks.pre_prompt | append {
code: " code: "
let direnv = (${pkgs.direnv}/bin/direnv export json | from json) let direnv = (${pkgs.direnv}/bin/direnv export json | from json)
let direnv = if ($direnv | length) == 1 { $direnv } else { {} } let direnv = if ($direnv | length) == 1 { $direnv } else { {} }

View File

@ -85,7 +85,7 @@ in {
type = types.nullOr (linesOrSource "env.nu"); type = types.nullOr (linesOrSource "env.nu");
default = null; default = null;
example = '' example = ''
let-env FOO = 'BAR' $env.FOO = 'BAR'
''; '';
description = '' description = ''
The environment variables file to be used for nushell. The environment variables file to be used for nushell.
@ -174,8 +174,7 @@ in {
(let (let
envVarsStr = concatStringsSep "\n" envVarsStr = concatStringsSep "\n"
(mapAttrsToList (k: v: "let-env ${k} = ${v}") (mapAttrsToList (k: v: "$env.${k} = ${v}") cfg.environmentVariables);
cfg.environmentVariables);
in mkIf (cfg.envFile != null || cfg.extraEnv != "" || envVarsStr != "") { in mkIf (cfg.envFile != null || cfg.extraEnv != "" || envVarsStr != "") {
"${configDir}/env.nu".text = mkMerge [ "${configDir}/env.nu".text = mkMerge [
(mkIf (cfg.envFile != null) cfg.envFile.text) (mkIf (cfg.envFile != null) cfg.envFile.text)

View File

@ -1,4 +1,4 @@
let-env FOO = 'BAR' $env.FOO = 'BAR'
let-env BAR = $'(echo BAZ)' $env.BAR = $'(echo BAZ)'

View File

@ -13,7 +13,7 @@
''; '';
envFile.text = '' envFile.text = ''
let-env FOO = 'BAR' $env.FOO = 'BAR'
''; '';
loginFile.text = '' loginFile.text = ''