@@ -19,7 +19,7 @@ EOF
22−nix_file=`dirname $0`/default.nix
22+nix_file=$(dirname "$0")/default.nix
24target="$1"
24target="$1"
@@ -38,21 +38,23 @@ shift
38bootstrap=nix-bootstrap
38bootstrap=nix-bootstrap
39if [ "$target" = "nix-bundle" ] || [ "$target" = "nixStable" ] || [ "$target" = "nixUnstable" ] || [ "$target" = "nix" ]; then
39if [ "$target" = "nix-bundle" ] || [ "$target" = "nixStable" ] || [ "$target" = "nixUnstable" ] || [ "$target" = "nix" ]; then
40 bootstrap=nix-bootstrap-nix
40 bootstrap=nix-bootstrap-nix
41−elif ! [ -z "$extraTargets" ]; then
41+elif [ -n "$extraTargets" ]; then
42 bootstrap=nix-bootstrap-path
42 bootstrap=nix-bootstrap-path
45expr="with import <nixpkgs> {}; with import $nix_file {}; $bootstrap { target = $target; extraTargets = [ $extraTargets ]; run = \"$exec\"; }"
45expr="with import <nixpkgs> {}; with import $nix_file {}; $bootstrap { target = $target; extraTargets = [ $extraTargets ]; run = \"$exec\"; }"
47−out=$(nix-store --no-gc-warning -r $(nix-instantiate --no-gc-warning -E "$expr"))
47+drv=$(nix-instantiate --no-gc-warning -E "$expr")
49+out=$(nix-store --no-gc-warning --realize "$drv")
49if [ -z "$out" ]; then
51if [ -z "$out" ]; then
50 >&2 echo "$0 failed. Exiting."
52 >&2 echo "$0 failed. Exiting."
52elif [ -t 1 ]; then
54elif [ -t 1 ]; then
53− filename=$(basename $exec)
55+ filename=$(basename "$exec")
54 echo "Nix bundle created at $filename."
56 echo "Nix bundle created at $filename."
55− cp -f $out $filename
57+ cp -f "$out" "$filename"
57− cat $out
59+ cat "$out"