Skip to content

Commit

Permalink
use nix-store --dump, not nix dump-path
Browse files Browse the repository at this point in the history
`nix dump-path` regressed, and now requires flakes to be enabled,
breaking nix-serve on systems without flakes being enabled.

However, `nix-store --dump` works fine across the board, so use that.

Nix issue: NixOS/nix#11225
Workaround in nixpkgs: NixOS/nixpkgs#331230
  • Loading branch information
flokli committed Jul 31, 2024
1 parent 4a12660 commit 29f7cde
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nix-serve.psgi
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ my $app = sub {
return [404, ['Content-Type' => 'text/plain'], ["Incorrect NAR hash. Maybe the path has been recreated.\n"]]
unless $narHash eq "sha256:$expectedNarHash";
my $fh = new IO::Handle;
open $fh, "-|", "nix", "dump-path", "--", $storePath;
open $fh, "-|", "nix-store", "--dump", "--", $storePath;
return [200, ['Content-Type' => 'text/plain', 'Content-Length' => $narSize], $fh];
}

Expand All @@ -74,7 +74,7 @@ my $app = sub {
return [404, ['Content-Type' => 'text/plain'], ["No such path.\n"]] unless $storePath;
my ($deriver, $narHash, $time, $narSize, $refs) = queryPathInfo($storePath, 1) or die;
my $fh = new IO::Handle;
open $fh, "-|", "nix", "dump-path", "--", $storePath;
open $fh, "-|", "nix-store", "--dump", "--", $storePath;
return [200, ['Content-Type' => 'text/plain', 'Content-Length' => $narSize], $fh];
}

Expand Down

0 comments on commit 29f7cde

Please sign in to comment.