From bcab0af638f6ae0b726eeab1f7d501d7594950d9 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 28 Sep 2025 16:47:01 +0200 Subject: [PATCH] haskellPackages.mkDerivation: convert .cabal file after prePatch cabal2nix emits prePatch = "hpack" for packages that need it, so the .cabal file may not exist before prePatch. --- pkgs/development/haskell-modules/generic-builder.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 31634958f546..6767cfa7af50 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -606,10 +606,13 @@ lib.fix ( echo "Replace Cabal file with edited version from ${newCabalFileUrl}." cp ${newCabalFile} ${pname}.cabal '' + + prePatch + + "\n" + # cabal2nix-generated expressions run hpack not until prePatch to create + # the .cabal file (if necessary) + lib.optionalString (!dontConvertCabalFileToUnix) '' sed -i -e 's/\r$//' *.cabal - '' - + prePatch; + ''; postPatch = optionalString jailbreak ''