From b6a3b8846e7a93cbcdf3acff099dd292d710d786 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 28 Dec 2025 15:31:09 +0100 Subject: [PATCH] haskell.lib.buildFromSdist: add test, fix double-patch Same issue as buildFromCabalSdist: sdistTarball applies patches via overrideDerivation, but the patches attribute remained, causing patchPhase to apply them again. --- pkgs/development/haskell-modules/lib/compose.nix | 3 ++- pkgs/test/haskell/cabalSdist/default.nix | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/lib/compose.nix b/pkgs/development/haskell-modules/lib/compose.nix index 055e6c40c784..372a9417906a 100644 --- a/pkgs/development/haskell-modules/lib/compose.nix +++ b/pkgs/development/haskell-modules/lib/compose.nix @@ -482,10 +482,11 @@ rec { overrideCabal (drv: { src = "${sdistTarball pkg}/${pkg.pname}-${pkg.version}.tar.gz"; - # Revising and jailbreaking the cabal file has been handled in sdistTarball + # Revising, jailbreaking and patches have been handled in sdistTarball revision = null; editedCabalFile = null; jailbreak = false; + patches = [ ]; }) pkg; /* diff --git a/pkgs/test/haskell/cabalSdist/default.nix b/pkgs/test/haskell/cabalSdist/default.nix index 1da18146b9d6..05d22e485e12 100644 --- a/pkgs/test/haskell/cabalSdist/default.nix +++ b/pkgs/test/haskell/cabalSdist/default.nix @@ -57,4 +57,17 @@ lib.recurseIntoAttrs rec { ${lib.getExe localPatchedFromCabalSdist} | grep "Patched" >/dev/null touch $out ''; + + # Test that buildFromSdist (non-cabal-install variant) also respects patches. + localPatchedFromSdist = haskell.lib.buildFromSdist localPatched; + + patchRespectedSdist = + runCommand "patchRespectedSdist" + { + nativeBuildInputs = [ localPatchedFromSdist ]; + } + '' + ${lib.getExe localPatchedFromSdist} | grep "Patched" >/dev/null + touch $out + ''; }