about summary refs log tree commit diff
path: root/src/nix-activate
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-03-25T16·36+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-03-25T16·36+0000
commit0f40a560cab23f70881e5af405ea112a869dc39a (patch)
tree2bb622fd0230a5f53c330b946cbbe90714139ad5 /src/nix-activate
parent3f1a1457e9ad91f93151200fe43c7c33ea95417b (diff)
* Added a script nix-activate which builds a list of "activated"
  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.

Diffstat (limited to 'src/nix-activate')
-rwxr-xr-xsrc/nix-activate22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/nix-activate b/src/nix-activate
new file mode 100755
index 000000000000..9fe6466866df
--- /dev/null
+++ b/src/nix-activate
@@ -0,0 +1,22 @@
+#! /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";