mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
direnv: simplify, work around nushell/nushell#14112
nushell 0.99 does not like early returns in hooks. So, what if we just didn't? Rewrite the entire hook to work as one single pipeline.
This commit is contained in:
parent
e78cbb2027
commit
1834304bc3
1 changed files with 12 additions and 20 deletions
|
@ -162,28 +162,20 @@ in {
|
|||
$env.config.hooks.pre_prompt?
|
||||
| default []
|
||||
| append {||
|
||||
let direnv = (
|
||||
${direnvWrapped}
|
||||
| from json --strict
|
||||
| default {}
|
||||
)
|
||||
if ($direnv | is-empty) {
|
||||
return
|
||||
}
|
||||
$direnv
|
||||
${direnvWrapped}
|
||||
| from json --strict
|
||||
| default {}
|
||||
| items {|key, value|
|
||||
{
|
||||
key: $key
|
||||
value: (do (
|
||||
$env.ENV_CONVERSIONS?
|
||||
| default {}
|
||||
| get -i $key
|
||||
| get -i from_string
|
||||
| default {|x| $x}
|
||||
) $value)
|
||||
}
|
||||
let value = do (
|
||||
$env.ENV_CONVERSIONS?
|
||||
| default {}
|
||||
| get -i $key
|
||||
| get -i from_string
|
||||
| default {|x| $x}
|
||||
) $value
|
||||
return [ $key $value ]
|
||||
}
|
||||
| transpose -ird
|
||||
| into record
|
||||
| load-env
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue