Created
June 25, 2016 00:46
-
-
Save olejorgenb/954c85d5c2722dd08c6d1ed5e420c80e to your computer and use it in GitHub Desktop.
nix-env "default nix expression" / "active nix expression" / top-level
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_nix_build_defexpr () { | |
local -a result | |
local -a queue=($1) | |
setopt local_options null_glob | |
while [[ ${#queue} > 0 ]]; do | |
local current=$queue[1] | |
shift queue | |
if [[ -e $current/default.nix ]]; then | |
result+=($current) | |
else | |
queue+=($current/*) | |
fi | |
done | |
local nix_expr="{\n" | |
for p in $result; do | |
nix_expr+="$(basename $p) = import $p {};" | |
nix_expr+="\n" | |
done | |
nix_expr+="}" | |
echo $nix_expr | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment