mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-02 15:41:48 +00:00
9fd5d70968
thanks to unionfs. For instance, nix-env and nixos-rebuild work. The tricky part was to build a Nix database (in the tmpfs/unionfs) which is now necessary to prevent store paths on the CD from being deleted right away because they otherwise wouldn't be valid. * nixos-install: use the /etc/nixos/configuration.nix from the target file system (don't copy it anymore). Since the user is supposed to mount the target file system on /mnt anyway, we may as well require that configuration.nix is placed in /mnt/etc/nixos. This also makes upgrading / reinstalling much easier, since it will automatically use the right configuration.nix. svn path=/nixos/trunk/; revision=10399
69 lines
1.6 KiB
Perl
69 lines
1.6 KiB
Perl
use strict;
|
|
use File::Basename;
|
|
|
|
my %storePaths;
|
|
my %refs;
|
|
|
|
foreach my $graph (@ARGV) {
|
|
open GRAPH, "<$graph" or die;
|
|
|
|
while (<GRAPH>) {
|
|
chomp;
|
|
my $storePath = "$_";
|
|
$storePaths{$storePath} = 1;
|
|
|
|
my $deriver = <GRAPH>; chomp $deriver;
|
|
my $count = <GRAPH>; chomp $count;
|
|
|
|
my @refs = ();
|
|
for (my $i = 0; $i < $count; ++$i) {
|
|
my $ref = <GRAPH>; chomp $ref;
|
|
push @refs, $ref;
|
|
}
|
|
$refs{$storePath} = \@refs;
|
|
|
|
}
|
|
|
|
close GRAPH;
|
|
}
|
|
|
|
|
|
if ($ENV{"printManifest"} eq "1") {
|
|
print "version {\n";
|
|
print " ManifestVersion: 3\n";
|
|
print "}\n";
|
|
|
|
foreach my $storePath (sort (keys %storePaths)) {
|
|
my $base = basename $storePath;
|
|
print "localPath {\n";
|
|
print " StorePath: $storePath\n";
|
|
print " CopyFrom: /tmp/inst-store/$base\n";
|
|
print " References: ";
|
|
foreach my $ref (@{$refs{$storePath}}) {
|
|
print "$ref ";
|
|
}
|
|
print "\n";
|
|
print "}\n";
|
|
}
|
|
}
|
|
|
|
elsif ($ENV{"printRegistration"} eq "1") {
|
|
# This is the format used by `nix-store --register-validity
|
|
# --hash-given' / `nix-store --load-db'.
|
|
foreach my $storePath (sort (keys %storePaths)) {
|
|
print "$storePath\n";
|
|
print "0000000000000000000000000000000000000000000000000000000000000000\n"; # !!! fix
|
|
print "\n"; # don't care about preserving the deriver
|
|
print scalar(@{$refs{$storePath}}), "\n";
|
|
foreach my $ref (@{$refs{$storePath}}) {
|
|
print "$ref\n";
|
|
}
|
|
}
|
|
}
|
|
|
|
else {
|
|
foreach my $storePath (sort (keys %storePaths)) {
|
|
print "$storePath\n";
|
|
}
|
|
}
|