nixpkgs-tools/treewideMainProgram/list_missing_main_programs.sh

22 lines
619 B
Bash
Raw Normal View History

2023-11-27 02:36:30 +01:00
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash ripgrep nix
FILES_WITHOUT_MAINPROGRAM=$(rg --case-sensitive --files-without-match "mainProgram" -g 'default.nix' .)
trap "exit 0" SIGINT
for FILE in $FILES_WITHOUT_MAINPROGRAM; do
PACKAGE=$(dirname "$FILE" | sed 's|^./||')
echo "Building: $PACKAGE"
NIXPKGS_ALLOW_UNFREE=1 nix build ".#$PACKAGE" --impure || continue
if [ "$(find result/bin | wc -w)" == 1 ]; then
echo "$PACKAGE: $(ls result/bin)" >> packages.txt
elif [ "$(find result-bin/bin | wc -w)" == 1 ]; then
echo "$PACKAGE: $(ls result-bin/bin)" >> packages.txt
fi
rm result* || true
done