From 734f8e6df2df113865eae037126a4f9cef2b61ac Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Wed, 15 Jun 2022 16:45:42 +0200 Subject: [PATCH] nix: fix static build - the isExecutable patch was broken, remove it - the ncurses fix was broken, we still need `enableStatic` - the original error was caused by the new ghc-bignum package, which isn't a "proper" Haskell package; we filter this out explicitly now --- nix/patches/default.nix | 4 ++-- .../static-haskell-nix-ghc-bignum.patch | 12 ++++++++++++ .../static-haskell-nix-isexecutable.patch | 18 ------------------ nix/patches/static-haskell-nix-ncurses.patch | 2 +- nix/static-haskell-package.nix | 2 +- 5 files changed, 16 insertions(+), 22 deletions(-) create mode 100644 nix/patches/static-haskell-nix-ghc-bignum.patch delete mode 100644 nix/patches/static-haskell-nix-isexecutable.patch diff --git a/nix/patches/default.nix b/nix/patches/default.nix index 880a8cece..552da7ac3 100644 --- a/nix/patches/default.nix +++ b/nix/patches/default.nix @@ -24,6 +24,6 @@ static-haskell-nix-ncurses = ./static-haskell-nix-ncurses.patch; - static-haskell-nix-isexecutable = - ./static-haskell-nix-isexecutable.patch; + static-haskell-nix-ghc-bignum = + ./static-haskell-nix-ghc-bignum.patch; } diff --git a/nix/patches/static-haskell-nix-ghc-bignum.patch b/nix/patches/static-haskell-nix-ghc-bignum.patch new file mode 100644 index 000000000..568880d92 --- /dev/null +++ b/nix/patches/static-haskell-nix-ghc-bignum.patch @@ -0,0 +1,12 @@ +diff --git a/survey/default.nix b/survey/default.nix +index 70afbbc..28cb0e9 100644 +--- a/survey/default.nix ++++ b/survey/default.nix +@@ -81,6 +81,7 @@ let + # `.override` and the likes). + isProperHaskellPackage = val: + lib.isDerivation val && # must pass lib.isDerivation ++ val.pname != "ghc-bignum" && + val ? env; # must have an .env key + + # Function that tells us if a given Haskell package has an executable. diff --git a/nix/patches/static-haskell-nix-isexecutable.patch b/nix/patches/static-haskell-nix-isexecutable.patch deleted file mode 100644 index a35adc885..000000000 --- a/nix/patches/static-haskell-nix-isexecutable.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/survey/default.nix b/survey/default.nix -index 46d8066..5f7950b 100644 ---- a/survey/default.nix -+++ b/survey/default.nix -@@ -85,10 +85,9 @@ let - # Function that tells us if a given Haskell package has an executable. - # Pass only Haskell packages to this! - # Filter away other stuff with `isProperHaskellPackage` first. -- isExecutable = pkg: -- (pkgs.haskell.lib.overrideCabal pkg (drv: { -- passthru.isExecutable = drv.isExecutable or false; -- })).isExecutable; -+ # FIXME postgrest: original fails with our nixpkgs version, we -+ # just hardcode the check to work for a static postgrest build. -+ isExecutable = pkg: pkg.name == "postgrest"; - - # Turn e.g. `Cabal_1_2_3_4` into `1.2.3.4`. - cabalDottedVersion = diff --git a/nix/patches/static-haskell-nix-ncurses.patch b/nix/patches/static-haskell-nix-ncurses.patch index 39c132741..195f84220 100644 --- a/nix/patches/static-haskell-nix-ncurses.patch +++ b/nix/patches/static-haskell-nix-ncurses.patch @@ -7,7 +7,7 @@ index 46d8066..a47f214 100644 "--enable-executable-static" # requires `useFixedCabal` # `enableShared` seems to be required to avoid `recompile with -fPIC` errors on some packages. - "--extra-lib-dirs=${final.ncurses.override { enableStatic = true; enableShared = true; }}/lib" -+ "--extra-lib-dirs=${final.ncurses}/lib" ++ "--extra-lib-dirs=${final.ncurses.override { enableStatic = true; }}/lib" ] # TODO Figure out why this and the below libffi are necessary. # `working` and `workingStackageExecutables` don't seem to need that, diff --git a/nix/static-haskell-package.nix b/nix/static-haskell-package.nix index 1c353970a..6710764cc 100644 --- a/nix/static-haskell-package.nix +++ b/nix/static-haskell-package.nix @@ -18,7 +18,7 @@ let static-haskell-nix [ patches.static-haskell-nix-ncurses - patches.static-haskell-nix-isexecutable + patches.static-haskell-nix-ghc-bignum ]; patchedNixpkgs =