From 13f5638a32eef5f3ff9576abfe8aa736c8e71b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Heredia=20Montiel?= Date: Tue, 17 Sep 2024 21:49:17 -0600 Subject: [PATCH] =?UTF-8?q?nix-serve:=20unstable-2018-03-20=20=E2=86=92=20?= =?UTF-8?q?unstable-2024-09-17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../package-management/nix-serve/default.nix | 13 +++++- .../nix-serve/nix-command.patch | 40 +++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 pkgs/tools/package-management/nix-serve/nix-command.patch diff --git a/pkgs/tools/package-management/nix-serve/default.nix b/pkgs/tools/package-management/nix-serve/default.nix index 018fe9ffb89fb..63080fda5eb4a 100644 --- a/pkgs/tools/package-management/nix-serve/default.nix +++ b/pkgs/tools/package-management/nix-serve/default.nix @@ -6,11 +6,12 @@ , perl , makeWrapper , nixosTests +, fetchpatch }: let - rev = "e4675e38ab54942e351c7686e40fabec822120b9"; - sha256 = "1wm24p6pkxl1d7hrvf4ph6mwzawvqi22c60z9xzndn5xfyr4v0yr"; + rev = "77ffa33d83d2c7c6551c5e420e938e92d72fec24"; + sha256 = "sha256-MJRdVO2pt7wjOu5Hk0eVeNbk5bK5+Uo/Gh9XfO4OlMY="; in stdenv.mkDerivation { @@ -23,6 +24,14 @@ stdenv.mkDerivation { inherit rev sha256; }; + patches = [ + # Part of https://github.com/edolstra/nix-serve/pull/61 + (fetchpatch { + url = "https://github.com/edolstra/nix-serve/commit/9e434fff4486afeb3cc3f631f6dc56492b204704.patch"; + sha256 = "sha256-TxQ6q6UApTKsYIMdr/RyrkKSA3k47stV63bTbxchNTU="; + }) + ]; + nativeBuildInputs = [ makeWrapper ]; dontBuild = true; diff --git a/pkgs/tools/package-management/nix-serve/nix-command.patch b/pkgs/tools/package-management/nix-serve/nix-command.patch new file mode 100644 index 0000000000000..5bf8eaac87117 --- /dev/null +++ b/pkgs/tools/package-management/nix-serve/nix-command.patch @@ -0,0 +1,40 @@ +From 9e434fff4486afeb3cc3f631f6dc56492b204704 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= +Date: Wed, 31 Jul 2024 23:53:31 +0200 +Subject: [PATCH] add extra-experimental-features for nix-command + +fixes https://github.com/NixOS/nixpkgs/pull/331230 +--- + nix-serve.psgi | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/nix-serve.psgi b/nix-serve.psgi +index 928fa3b..65a8680 100644 +--- a/nix-serve.psgi ++++ b/nix-serve.psgi +@@ -64,7 +64,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", "--extra-experimental-features", "nix-command", "dump-path", "--", $storePath; + return [200, ['Content-Type' => 'text/plain', 'Content-Length' => $narSize], $fh]; + } + +@@ -75,14 +75,14 @@ my $app = sub { + return [404, ['Content-Type' => 'text/plain'], ["No such path.\n"]] unless $storePath; + my ($deriver, $narHash, $time, $narSize, $refs) = $store->queryPathInfo($storePath, 1) or die; + my $fh = new IO::Handle; +- open $fh, "-|", "nix", "dump-path", "--", $storePath; ++ open $fh, "-|", "nix", "--extra-experimental-features", "nix-command", "dump-path", "--", $storePath; + return [200, ['Content-Type' => 'text/plain', 'Content-Length' => $narSize], $fh]; + } + + elsif ($path =~ /^\/log\/([0-9a-z]+-[0-9a-zA-Z\+\-\.\_\?\=]+)/) { + my $storePath = "$Nix::Config::storeDir/$1"; + my $fh = new IO::Handle; +- open $fh, "-|", "nix", "log", $storePath; ++ open $fh, "-|", "nix", "--extra-experimental-features", "nix-command", "log", $storePath; + return [200, ['Content-Type' => 'text/plain' ], $fh]; + } +