scripts: add a script to clean the git dir

This commit is contained in:
Colin 2024-05-13 20:29:01 +00:00
parent be84ab1f45
commit 67434caf45

19
scripts/clean Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
# remove artifacts which i've accidentally left lying around
# e.g. `result -> /nix/store/...` symlinks
pushd ..
for result in $(fd --follow result); do
if [[ "$(readlink "$result")" != /nix/store/* ]]; then
# not a build artifact
continue
fi
if [[ "$result" == build/* ]] || [[ "$result" == .working/* ]]; then
# intentionally preserved build artifact
continue
fi
echo "removing: $result"
unlink "$result"
done
popd