diff options
Diffstat (limited to 'scripts/nix-push')
-rw-r--r-- | scripts/nix-push | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/scripts/nix-push b/scripts/nix-push index 14b7e2834675..731532f1e9a4 100644 --- a/scripts/nix-push +++ b/scripts/nix-push @@ -11,9 +11,9 @@ foreach my $hash (@ARGV) { my @paths; open PATHS, "nix -qrh $hash 2> /dev/null |" or die "nix -qrh"; while (<PATHS>) { - chomp; - next unless /^\//; - push @paths, $_; + chomp; + next unless /^\//; + push @paths, $_; } close PATHS; @@ -21,38 +21,38 @@ foreach my $hash (@ARGV) { # a Nix archive. foreach my $path (@paths) { - # Hash the path. - my $phash = `nix-hash $path`; - $? and die "nix-hash"; - chomp $phash; - die unless $phash =~ /^([0-9a-z]{32})$/; + # Hash the path. + my $phash = `nix-hash $path`; + $? and die "nix-hash"; + chomp $phash; + die unless $phash =~ /^([0-9a-z]{32})$/; - # Construct a Fix expression that creates a Nar archive. - my $fixexpr = + # Construct a Fix expression that creates a Nar archive. + my $fixexpr = "App(IncludeFix(\"nar/nar.fix\"), " . "[ (\"path\", Path(\"$path\", Hash(\"$phash\"), [Include(\"$hash\")]))" . ", (\"name\", \"$phash.nar\")" . "])"; - my $fixfile = "/tmp/nix-push-tmp.fix"; - open FIX, ">$fixfile"; - print FIX $fixexpr; - close FIX; + my $fixfile = "/tmp/nix-push-tmp.fix"; + open FIX, ">$fixfile"; + print FIX $fixexpr; + close FIX; - # Instantiate a Nix expression from the Fix expression. - my $nhash = `fix $fixfile`; - $? and die "instantiating Nix archive expression"; - chomp $nhash; - die unless $nhash =~ /^([0-9a-z]{32})$/; + # Instantiate a Nix expression from the Fix expression. + my $nhash = `fix $fixfile`; + $? and die "instantiating Nix archive expression"; + chomp $nhash; + die unless $nhash =~ /^([0-9a-z]{32})$/; - # Realise the Nix expression. - my $npath = `nix -qph $nhash 2> /dev/null`; - $? and die "creating Nix archive"; - chomp $npath; + # Realise the Nix expression. + my $npath = `nix -qph $nhash 2> /dev/null`; + $? and die "creating Nix archive"; + chomp $npath; - push @pushlist, $npath; + push @pushlist, $npath; - print "$path -> $npath\n"; + print "$path -> $npath\n"; } } |