Files: 03e288c9b9e4d60e7d19ac8bd0cdaa7b052221ec / bin / nix-environment
661 bytesRaw
1 | #!/usr/bin/env bash |
2 | |
3 | # Execute things in an ephemeral nix environment context, with similar |
4 | # syntax as `guix environment --ad-hoc`: |
5 | # nix-environment <package_1> [ ... <package_n> ] -- \ |
6 | # command [ <arg_1> [ ... <arg_n>]] |
7 | |
8 | EL_BIN=/nix/var/nix/profiles/execline/bin |
9 | |
10 | while (( $# >= 1 )); do |
11 | if [[ $1 == "--" ]]; then |
12 | shift |
13 | break |
14 | fi |
15 | packages+=( "$1" ) |
16 | shift |
17 | done |
18 | |
19 | export PACKAGES=$(PATH=${EL_BIN}:$PATH execlineb -c 'dollarat -d ""' "${packages[@]}") |
20 | |
21 | exec ${EL_BIN}/execlineb -c " |
22 | ${EL_BIN}/import -u EL_BIN"' |
23 | ${EL_BIN}/import -u -s -d "" PACKAGES |
24 | nix-shell -p $PACKAGES --run |
25 | "exec '"'"'${EL_BIN}/elgetpositionals'"'"' \\$@" |
26 | ' "$@" |
Built with git-ssb-web