Files
nix-files/scripts/clean

20 lines
457 B
Bash
Executable File

#!/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