mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +02:00
f7526febe4
doesn't actually delete any packages, it just prints their descriptor hashes. So we can do nix info $(nix-collect-garbage) to print out the ids of the packages that would be deleted, and nix delpkg $(nix-collect-garbage) to actually delete them.
22 lines
357 B
Perl
Executable file
22 lines
357 B
Perl
Executable file
#! /usr/bin/perl -w
|
|
|
|
my $prefix = $ENV{"NIX"} || "/nix"; # !!! use prefix
|
|
my $linkdir = "$prefix/var/nix/links";
|
|
|
|
my %alive;
|
|
|
|
open HASHES, "nix closure \$(cat $linkdir/*.hash) |";
|
|
while (<HASHES>) {
|
|
chomp;
|
|
$alive{$_} = 1;
|
|
}
|
|
close HASHES;
|
|
|
|
open HASHES, "nix listinst |";
|
|
while (<HASHES>) {
|
|
chomp;
|
|
if (!$alive{$_}) {
|
|
print "$_\n";
|
|
}
|
|
}
|
|
close HASHES;
|