mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 03:29:45 +01: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
|
||||
| items {|key, value|
|
||||
{
|
||||
key: $key
|
||||
value: (do (
|
||||
let value = do (
|
||||
$env.ENV_CONVERSIONS?
|
||||
| default {}
|
||||
| get -i $key
|
||||
| get -i from_string
|
||||
| default {|x| $x}
|
||||
) $value)
|
||||
) $value
|
||||
return [ $key $value ]
|
||||
}
|
||||
}
|
||||
| transpose -ird
|
||||
| into record
|
||||
| load-env
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue