Commit 5d7c526593021a9cf8f0a19bb829d355b383f2d1
nix-environment: Use netstring and execline import to eliminate the pipe and xargs
Claes Wallin (韋嘉誠) committed on 10/15/2016, 10:10:49 AMParent: a30d3c7d4c16b027c405969595df0d81e565b73c
Files changed
bin/nix-environment | changed |
bin/nix-environment | |||
---|---|---|---|
@@ -1,10 +1,8 @@ | |||
1 | 1 … | #!/usr/bin/env bash | |
2 | 2 … | ||
3 | 3 … | EL_BIN=/nix/var/nix/profiles/execline/bin | |
4 | 4 … | ||
5 | -packages=() | ||
6 | - | ||
7 | 5 … | while (( $# >= 1 )); do | |
8 | 6 … | if [[ $1 == "--" ]]; then | |
9 | 7 … | shift | |
10 | 8 … | break | |
@@ -12,7 +10,7 @@ | |||
12 | 10 … | packages+=( "$1" ) | |
13 | 11 … | shift | |
14 | 12 … | done | |
15 | 13 … | ||
16 | -exec 3<&0 | ||
17 | -printf '%s\0' "$@" | | ||
18 | - nix-shell -p "${packages[@]}" --run "xargs -0 bash -c 'exec <&3- \"\$@\"' nix-environment" | ||
14 … | +export PARAMS=$(${EL_BIN}/execlineb -c "${EL_BIN}/dollarat"' -d ""' "$@") | ||
15 … | + | ||
16 … | +exec nix-shell -p "${packages[@]}" --run "${EL_BIN}/import -s -d '' PARAMS '\$PARAMS'" |
Built with git-ssb-web