Created
October 28, 2016 13:28
-
-
Save vcunat/b2eb3e8e8a916f1656ba4d1c7e5e4e32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ "$#" != 2 ]; then | |
echo "Usage: $0 commit-hash commit-hash" | |
echo -e "\tYou need to be in a git-controlled nixpkgs tree." | |
exit 1 | |
fi | |
echo "Estimating rebuild amount, by packages visible to nix-env:" | |
echo "(If you get 0, it's an evaluation error, most likely.)" | |
# Output packages in tree $2 that weren't in $1. | |
# Changing the output hash or name is taken as a change. | |
# Extra nix-env parameters can be in $3 | |
newPkgs() { | |
comm -13 \ | |
<(nix-env -f "$1" -qa --out-path --show-trace $3 | sort) \ | |
<(nix-env -f "$2" -qa --out-path --show-trace $3 | sort) | |
} | |
declare -a tree | |
for i in 1 2; do | |
tree[$i]="$(mktemp --tmpdir -d nix-rebuild-amount-XXXXXXXX)" | |
done | |
cleanup() { | |
rm -rf "${tree[1]}" "${tree[2]}" | |
} | |
trap cleanup EXIT SIGINT SIGQUIT ERR | |
for i in 1 2; do | |
git "--work-tree=${tree[$i]}" checkout "${!i}" "*" | |
done | |
for platform in x86_64-{linux,darwin}; do | |
newPkgs "${tree[1]}" "${tree[2]}" "--argstr system $platform" \ | |
2>/dev/null \ | |
| (wc -l; echo "^ $platform") & | |
done | |
wait | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@vcunat You can set "config" as an arg to override ~/.nixpkgs/config.nix. For example: