#!/usr/bin/env bash # Execute things in an ephemeral nix environment context, with similar # syntax as `guix environment --ad-hoc`: # nix-environment [ ... ] -- \ # command [ [ ... ]] EL_BIN=/nix/var/nix/profiles/execline/bin while (( $# >= 1 )); do if [[ $1 == "--" ]]; then shift break fi packages+=( "$1" ) shift done export PACKAGES=$(PATH=${EL_BIN}:$PATH execlineb -c 'dollarat -d ""' "${packages[@]}") exec ${EL_BIN}/execlineb -c " ${EL_BIN}/import -u EL_BIN"' ${EL_BIN}/import -u -s -d "" PACKAGES nix-shell -p $PACKAGES --run "exec '"'"'${EL_BIN}/elgetpositionals'"'"' \\$@" ' "$@"