Fix closure.sh

Usage is:

find -L $(./closure.sh inkscape) -name '*.a' -exec du -a {} + \
  | sort -nr

to find large .a files
This commit is contained in:
Matthew Bauer 2017-02-12 18:26:09 -06:00
parent 43f167eb0d
commit 07e28d9384

View File

@ -1,27 +1,7 @@
#!/usr/bin/env sh
if [ "$#" -lt 1 ]; then
cat <<EOF
Usage: $0 TARGET
Create a closure from the nixpkgs attribute "TARGET".
EOF
exit 1
fi
target="$1"
expr="with import <nixpkgs> {}; with import ./. {}; closure { targets = [$target]; }"
out=$(nix-store --no-gc-warning -r $(nix-instantiate --no-gc-warning -E "$expr"))
if [ -z "$out" ]; then
echo "$0 failed. Exiting."
exit 1
else
rm -f result
ln -sf $out result
echo "Dir created at result"
fi
nix-store --no-gc-warning -r $(nix-instantiate --no-gc-warning -E "$expr")