0f40a560ca
packages (i.e., the packages that should appear in the user's $PATH, and so on). Based on this list, the script nix-populate creates a hierarchy of symlinks to the relevant files in those packages (e.g., for pkg/bin and pkg/lib). A nice property of nix-populate is that on each run it creates a *new* tree, rather than updating the old one. It then atomically switches over to the new tree. This allows atomic upgrades or rollbacks on the set of activated packages.
22 lines
399 B
Perl
Executable file
22 lines
399 B
Perl
Executable file
#! /usr/bin/perl -w
|
|
|
|
use strict;
|
|
|
|
my $pkglist = "/home/eelco/.nixactivations";
|
|
|
|
if (!-f $pkglist) {
|
|
system "touch $pkglist";
|
|
}
|
|
|
|
my $hash;
|
|
foreach $hash (@ARGV) {
|
|
system "grep -q $hash $pkglist";
|
|
if ($?) {
|
|
print STDERR "activating $hash\n";
|
|
system "nix getpkg $hash > /dev/null";
|
|
if ($?) { die "`nix getpkg' failed"; }
|
|
system "echo $hash >> $pkglist";
|
|
}
|
|
}
|
|
|
|
system "nix-populate";
|