1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-03 16:39:46 +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:
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
| 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
}
)