Last active
January 20, 2020 04:45
-
-
Save CMCDragonkai/0908706df9c9dbc45575a2345fab93f1 to your computer and use it in GitHub Desktop.
Garbage collect `./result*` symlinks using Nix #nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# if no argument is passed in, we use the current directory | |
dir="${1:-.}" | |
while IFS= read -r -d '' file; do | |
store_path="$(readlink "$file")" | |
rm --verbose "$file" | |
nix-store --delete "$store_path" | |
done < <(find "$dir" -maxdepth 1 -type l -lname '/nix/store/*' -print0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should be turned into an application that can be installed it seems quite useful to alot of people.
Also this should be renamed
nix-build-gc
.