Skip to content

Instantly share code, notes, and snippets.

@grahamc
Last active February 4, 2019 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamc/84e7d2aabbf346f3e7a5e56578c257ec to your computer and use it in GitHub Desktop.
Save grahamc/84e7d2aabbf346f3e7a5e56578c257ec to your computer and use it in GitHub Desktop.
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix jq findutils coreutils --pure
LOGFILE=./reproducibility-log
(
# fairly safe... store paths won't have spaces
for drv in $(find /nix/store -maxdepth 1 -name '*.drv'); do
# nor will they have quotes v v
out=$(nix show-derivation "$drv" | jq -r '.["'"$drv"'"].outputs.out.path')
if [ ! -e "$out" ]; then
echo "out missing: $drv" >&2
elif grep -q "$drv" "$LOGFILE"; then
echo "already checked: $drv" >&2
elif nix-build "$drv" --check >&2; then
printf "reproducible\t%s\n" "$drv"
else
printf "irreproducible\t%s\n" "$drv"
fi
done
) | tee -a "$LOGFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment