Skip to content

Commit da073d5

Browse files
committed
Remove workarounds no longer necessary with nixos-23.05
1 parent 9dd4c43 commit da073d5

File tree

1 file changed

+32
-69
lines changed

1 file changed

+32
-69
lines changed

survey/default.nix

Lines changed: 32 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -588,16 +588,21 @@ let
588588

589589
lzma = previous.lzma.overrideAttrs (old: { dontDisableStatic = true; });
590590

591-
# Note [Packages that can't be overridden by overlays]
592-
# TODO: Overriding the packages mentioned here has no effect in overlays.
593-
# This is because of https://github.com/NixOS/nixpkgs/issues/61682.
594-
# That's why we make up new package names with `_static` at the end,
595-
# and explicitly give them to packages or as linker flags in `statify`.
596-
# See also that link for the total list of packages that have this problem.
597-
# As of original finding it is, as per `pkgs/stdenv/linux/default.nix`:
598-
# gzip bzip2 xz bash coreutils diffutils findutils gawk
599-
# gnumake gnused gnutar gnugrep gnupatch patchelf
600-
# attr acl zlib pcre
591+
# Note [Packages that cause bootstrap compiler recompilation]
592+
# The following packages are compiler bootstrap dependencies.
593+
# While we could override them to have static libraries
594+
# (now that https://github.com/NixOS/nixpkgs/issues/61682 is fixed),
595+
# we don't currently because that would make even the compiler bootstrapping recompile.
596+
# Instead we make up new package names with `_static` at the end,
597+
# and explicitly give them to packages.
598+
# See also the above link for the total list of packages that are relevant for this.
599+
# As of original finding it is, as per `pkgs/stdenv/linux/default.nix`:
600+
# gzip bzip2 xz bash coreutils diffutils findutils gawk
601+
# gnumake gnused gnutar gnugrep gnupatch patchelf
602+
# attr acl zlib pcre
603+
# TODO: Check if this really saves enough compilation to be worth the added complexity.
604+
# Alternatively, try to override the bootstrap compiler to use the original
605+
# ones; then we can override the normal names here.
601606
acl_static = previous.acl.overrideAttrs (old: { dontDisableStatic = true; });
602607
attr_static = previous.attr.overrideAttrs (old: { dontDisableStatic = true; });
603608
bash_static = previous.bash.overrideAttrs (old: { dontDisableStatic = true; });
@@ -628,28 +633,6 @@ let
628633
#
629634
# So somehow, the above `zlib_static` uses *this* `zlib`, even though
630635
# the above uses `previous.zlib.override` and thus shouldn't see this one.
631-
#zlib = issue_61682_throw "zlib" previous.zlib;
632-
# Similarly, we don't know why these are are evaluated, but it happens for
633-
# https://github.com/nh2/static-haskell-nix/issues/47.
634-
#bzip2 = issue_61682_throw "bzip2" previous.bzip2;
635-
#pcre = issue_61682_throw "pcre" previous.pcre;
636-
# Since the update to nixpkgs master for #61 also for these,
637-
# see https://github.com/NixOS/nixpkgs/issues/61682#issuecomment-544215621
638-
#acl = issue_61682_throw "acl" previous.acl;
639-
#attr = issue_61682_throw "attr" previous.attr;
640-
#bash = issue_61682_throw "bash" previous.bash;
641-
#coreutils = issue_61682_throw "coreutils" previous.coreutils;
642-
#diffutils = issue_61682_throw "diffutils" previous.diffutils;
643-
#findutils = issue_61682_throw "findutils" previous.findutils;
644-
#gawk = issue_61682_throw "gawk" previous.gawk;
645-
#gnugrep = issue_61682_throw "gnugrep" previous.gnugrep;
646-
#gnumake = issue_61682_throw "gnumake" previous.gnumake;
647-
#gnupatch = issue_61682_throw "gnupatch" previous.gnupatch;
648-
#gnused = issue_61682_throw "gnused" previous.gnused;
649-
#gnutar = issue_61682_throw "gnutar" previous.gnutar;
650-
#gzip = issue_61682_throw "gzip" previous.gzip;
651-
#patchelf = issue_61682_throw "patchelf" previous.patchelf;
652-
#xz = issue_61682_throw "xz" previous.xz;
653636

654637
# The test-suite for PostgreSQL 13 fails:
655638
# https://github.com/NixOS/nixpkgs/issues/150930
@@ -734,17 +717,7 @@ let
734717
libjpeg = previous.libjpeg.override (old: { enableStatic = true; });
735718
libjpeg_turbo = previous.libjpeg_turbo.override (old: { enableStatic = true; });
736719

737-
openblas = (previous.openblas.override { enableStatic = true; }).overrideAttrs (old: {
738-
# openblas doesn't create symlinks for static archives like libblas.a and
739-
# liblapack.a. The following lines fixes this.
740-
# https://github.com/NixOS/nixpkgs/pull/151049
741-
postInstall = old.postInstall + ''
742-
ln -s $out/lib/libopenblas.a $out/lib/libblas.a
743-
ln -s $out/lib/libopenblas.a $out/lib/libcblas.a
744-
ln -s $out/lib/libopenblas.a $out/lib/liblapack.a
745-
ln -s $out/lib/libopenblas.a $out/lib/liblapacke.a
746-
'';
747-
});
720+
openblas = (previous.openblas.override { enableStatic = true; });
748721

749722
openssl = previous.openssl.override { static = true; };
750723

@@ -773,7 +746,7 @@ let
773746
woff2 = previous.woff2.override { static = true; };
774747

775748
# See comments on `statify_curl_including_exe` for the interaction with krb5!
776-
# As mentioned in [Packages that can't be overridden by overlays], we can't
749+
# As mentioned in [Packages that cause bootstrap compiler recompilation], we can't
777750
# override zlib to have static libs, so we have to pass in `zlib_both` explicitly
778751
# so that `curl` can use it.
779752
curl = statify_curl_including_exe previous.curl final.zlib_both;
@@ -784,7 +757,7 @@ let
784757
# `fetchurl` uses our overridden `curl` above, but `fetchurl` overrides
785758
# `zlib` in `curl`, see
786759
# https://github.com/NixOS/nixpkgs/blob/4a5c0e029ddbe89aa4eb4da7949219fe4e3f8472/pkgs/top-level/all-packages.nix#L296-L299
787-
# so because of [Packages that can't be overridden by overlays],
760+
# so because of [Packages that cause bootstrap compiler recompilation],
788761
# it will undo our `zlib` override in `curl` done above (for `curl`
789762
# use via `fetchurl`).
790763
# So we need to explicitly put our zlib into that one's curl here.
@@ -888,21 +861,14 @@ let
888861
# Helper function to add pkg-config static lib flags to a Haskell derivation.
889862
# We put it directly into the `pkgs` package set so that following overlays
890863
# can use it as well if they want to.
864+
#
865+
# Note that for linking the order of libraries given on the command line matters:
866+
# https://stackoverflow.com/questions/11893996/why-does-the-order-of-l-option-in-gcc-matter
867+
# Before my GHC change https://gitlab.haskell.org/ghc/ghc/merge_requests/1589
868+
# was merged that ensured the order is correct, we used a hack using
869+
# `--ld-option=-Wl,--start-group` to make the order not matter.
891870
staticHaskellHelpers.addStaticLinkerFlagsWithPkgconfig = haskellDrv: pkgConfigNixPackages: pkgconfigFlagsString:
892-
with final.haskell.lib; overrideCabal (appendConfigureFlag haskellDrv [
893-
# Ugly alert: We use `--start-group` to work around the fact that
894-
# the linker processes `-l` flags in the order they are given,
895-
# so order matters, see
896-
# https://stackoverflow.com/questions/11893996/why-does-the-order-of-l-option-in-gcc-matter
897-
# and GHC inserts these flags too early, that is in our case, before
898-
# the `-lcurl` that pulls in these dependencies; see
899-
# https://github.com/haskell/cabal/pull/5451#issuecomment-406759839
900-
# Note that current binutils emit a warning:
901-
# ld: missing --end-group; added as last command line option
902-
# TODO: This can be removed once we have GHC 8.10, due to my merged PR:
903-
# https://gitlab.haskell.org/ghc/ghc/merge_requests/1589
904-
"--ld-option=-Wl,--start-group"
905-
]) (old: {
871+
with final.haskell.lib; overrideCabal haskellDrv (old: {
906872
# We can't pass all linker flags in one go as `ld-options` because
907873
# the generic Haskell builder doesn't let us pass flags containing spaces.
908874
preConfigure = builtins.concatStringsSep "\n" [
@@ -1023,7 +989,7 @@ let
1023989
# Override zlib Haskell package to use the system zlib package
1024990
# that has `.a` files added.
1025991
# This is because the system zlib package can't be overridden accordingly,
1026-
# see note [Packages that can't be overridden by overlays].
992+
# see note [Packages that cause bootstrap compiler recompilation].
1027993
zlib = super.zlib.override { zlib = final.zlib_both; };
1028994

1029995
# The `properties` test suite takes > 30 minutes with `-O0`.
@@ -1186,7 +1152,7 @@ let
11861152
"--libs bzip2";
11871153

11881154
# Override libs explicitly that can't be overridden with overlays.
1189-
# See note [Packages that can't be overridden by overlays].
1155+
# See note [Packages that cause bootstrap compiler recompilation].
11901156
regex-pcre = super.regex-pcre.override { pcre = final.pcre_static; };
11911157
pcre-light = super.pcre-light.override { pcre = final.pcre_static; };
11921158
bzlib-conduit = super.bzlib-conduit.override { bzip2 = final.bzip2_static; };
@@ -1405,14 +1371,6 @@ let
14051371
sha256 = "05bbn63sn18s6c7gpcmzbv4hyfhn1i9bd2bw76bv6abr58lnrwk3";
14061372
}) {};
14071373

1408-
# Override yaml on old versions to fix https://github.com/NixOS/cabal2nix/issues/372.
1409-
# I've checked that versions >= 0.11.0.0 in nixpkgs on ghc864 don't need this
1410-
# but `yaml-0.8.32` on ghc844 still does.
1411-
yaml =
1412-
if final.lib.versionOlder super.yaml.version "0.11.0.0"
1413-
then disableCabalFlag super.yaml "system-libyaml"
1414-
else super.yaml;
1415-
14161374
# TODO Find out why these overrides are necessary, given that they all come from `final`
14171375
# (somehow without them, xmonad gives linker errors).
14181376
# Most likely it is because the `libX*` packages are available once on the top-level
@@ -1533,6 +1491,11 @@ let
15331491
# Exception: test-files/trivial.proto: openFile: does not exist (No such file or directory)
15341492
# 2 out of 71 tests failed (1.97s)
15351493
proto3-suite = dontCheck super.proto3-suite;
1494+
1495+
# Fix syntax error in test.
1496+
# Remove when nixpkgs has data-diverse >= 4.7.1.0, see:
1497+
# https://github.com/louispan/data-diverse/commit/50d79a011d2a9c55ca4b21a424f177d6bbd2663c
1498+
data-diverse = markUnbroken (dontCheck super.data-diverse);
15361499
});
15371500

15381501
});

0 commit comments

Comments
 (0)