#!/usr/bin/env bash set -e # --print: avoid dependency on environment optPrint= if [ "$1" == "--print" ]; then optPrint=true shift fi if [ "$#" != 1 ] && [ "$#" != 2 ]; then cat < "$expr" nix-env -f "$expr" -qaP --no-name --out-path --show-trace $3 \ | sort > "${list[$i]}" & if [ "$parallel" != "true" ]; then wait fi done wait comm -13 "${list[@]}" } # Prepare nixpkgs trees. declare -a tree for i in 1 2; do if [ -n "${!i}" ]; then # use the given commit dir="$($MKTEMP -d)" tree[$i]="$dir" toRemove+=("$dir") git clone --shared --no-checkout --quiet . "${tree[$i]}" (cd "${tree[$i]}" && git checkout --quiet "${!i}") else #use the current tree tree[$i]="$(pwd)" fi done newlist="$($MKTEMP)" toRemove+=("$newlist") # Notes: # - the evaluation is done on x86_64-linux, like on Hydra. # - using $newlist file so that newPkgs() isn't in a sub-shell (because of toRemove) newPkgs "${tree[1]}" "${tree[2]}" '--argstr system "x86_64-linux"' > "$newlist" # Hacky: keep only the last word of each attribute path and sort. sed -n 's/\([^. ]*\.\)*\([^. ]*\) .*$/\2/p' < "$newlist" \ | sort | uniq -c if [ -n "$optPrint" ]; then echo cat "$newlist" fi