1
0
Fork 0
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:
K900 2024-10-17 22:10:39 +03:00 committed by Robert Helgesson
parent e78cbb2027
commit 1834304bc3
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED

View file

@ -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
}
)