nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 33 lines 887 B view raw
1#! @shell@ 2 3fixupHooks=() 4 5if [ -e @out@/nix-support/setup-hooks.sh ]; then 6 source @out@/nix-support/setup-hooks.sh 7fi 8 9excludes="" 10while getopts e: o; do 11 case "$o" in 12 e) storeId=$(echo "$OPTARG" | @perl@/bin/perl -ne "print \"\$1\" if m|^\Q@storeDir@\E/([a-z0-9]{32})-.*|") 13 if [ -z "$storeId" ]; then 14 echo "-e argument must be a Nix store path" 15 exit 1 16 fi 17 excludes="$excludes(?!$storeId)" 18 ;; 19 esac 20done 21shift $(($OPTIND-1)) 22 23for i in "$@"; do 24 if test ! -L "$i" -a -f "$i"; then 25 cat "$i" | @perl@/bin/perl -pe "s|\Q@storeDir@\E/$excludes[a-z0-9]{32}-|@storeDir@/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" > "$i.tmp" 26 if test -x "$i"; then chmod +x "$i.tmp"; fi 27 mv "$i.tmp" "$i" 28 29 for hook in "${fixupHooks[@]}"; do 30 eval "$hook" "$i" 31 done 32 fi 33done