Files: 83e303c45fd32bc34d2cd8c96b7aa2c84a431af0 / bin / nix-environment
549 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 PARAMS=$(PATH=${EL_BIN}:$PATH execlineb -c 'dollarat -d ""' "$@") |
20 | |
21 | exec nix-shell -p "${packages[@]}" --run "exec '${EL_BIN}/import' -s -d '' PARAMS '\$PARAMS'" |
Built with git-ssb-web