From d0ddc2664f04b27fad1db6c84ea8b3a903768cb0 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Fri, 27 Mar 2026 14:46:48 +0100 Subject: [PATCH] stack: make sure cacert database is available when making HTTPS reqs Resolves https://github.com/NixOS/nixpkgs/issues/499796. --- .../haskell-modules/configuration-common.nix | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 082ea8b18a81..e8afdefc3ea2 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -176,6 +176,29 @@ with haskellLib; } ); + # Stack uses pure nix-shells for certain operations including HTTPS requests + # This patch makes stack add pkgs.cacert, so the certificate DB is available. + # https://github.com/commercialhaskell/stack/pull/6854 krank:ignore-line + stack = + appendPatches + [ + (pkgs.fetchpatch { + name = "stack-add-cacert-to-pure-shells.patch"; + url = "https://github.com/commercialhaskell/stack/commit/e869263cbd84a9e59ce1fa467e82993c8e7fb1dd.patch"; + hash = "sha256-O7GaNgcGBY6m6GHqVtejqOu2HCWWKWXARPnr/upT1RQ="; + includes = [ "src/Stack/Nix.hs" ]; + }) + ] + ( + overrideCabal (drv: { + # Stack's source files use CRLF + prePatch = '' + ${drv.prePatch or ""} + sed -i -e 's/\r$//' src/Stack/Nix.hs + ''; + }) super.stack + ); + # Extensions wants a specific version of Cabal for its list of Haskell # language extensions. extensions = doJailbreak (