Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
1.9 kB · 87 lines
Shell
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788#!@runtimeShell@
# baked variables, not exportedbashrc='@bashrc@'bash='@bashInteractive@/bin/bash'
# detected variables and option defaultsshell="$(basename $SHELL)"mode=interactive
# remaining argsargs=()
# parse argumentswhile [[ $# -gt 0 ]]; do case "$1" in -c) mode=commands shift break ;; *) mode=exec break ;; esacdone
while [[ $# -gt 0 ]]; do args+=("$1") shiftdone
case "$mode" in interactive) ;; commands) if ${#args[@]} -eq 0; then echo "nixpkgs: You've requested a command shell, but didn't provide a command." echo " Please provide a command to run." exit 1 fi ;; exec) ;;esac
invokeWithArgs() { bash -c 'source "'"$bashrc"'"; _script="$(shift)"; _args=("$@"); eval "$_script"' -- "$@"}
# For bash, we'll run the interactive variant of the version Nixpkgs uses.# For other shells, version correctness can't be a goal, so it's best# to launch the user's shell from $SHELL. This also avoids bringing in# dependencies of which N-1 aren't needed. Keeps it quick.launchBash() { case "$mode" in interactive) exec "$bash" --rcfile "$bashrc" "${args[@]}" ;; commands) exec "$bash" -c 'source "'"$bashrc"'"; _script="$1"; shift; eval "$_script"' -- "${args[@]}" ;; exec) exec "$bash" -c 'source "'"$bashrc"'"; "$@"' -- "${args[@]}" ;; esac}
launchShell() { case "$shell" in bash|"") launchBash ;; *) ( echo "nixpkgs: I see that you weren't running bash. That's cool, but" echo " stdenv derivations are built with bash, so that's what" echo " I'll run for you by default. We'd love to have support" echo " for many shells, so PRs are welcome!" ) >&2 launchBash ;; esac}
launchShell