Skip to content

Commit aa50123

Browse files
committed
Update nixpkgs to latest master. Fixes #56.
Changes made to make CI green: * Temporarily disable cachix (it pulls in non-building deps) * survey: Don't try to patch cabal-3.0.0.0 (upstreamed patches) * Use zlib_both for building curl. Fixes that in latest nixpkgs master, the curl build sees the old, unoverridden zlib, even though we passed in an overridden one. https://buildkite.com/nh2/static-haskell-nix/builds/113#3551cfdf-fe73-4a75-a6dc-1cd3ae430860 * Fix fetchurl pulling in correct curl but incorrect zlib * nixpkgs: Update submodule for: postgresql: Fix 2 failing tests on musl * Add postgresql-orm pkgconfig override * Add pg-harness-server pkgconfig override * Add more test-looping packages * nixpkgs: Update submodule to fix polkit on musl * Disable Java support in R * Fixes for inline-r and H, but then giving up on H for now * static-stack: Use lts-12
1 parent d718ea6 commit aa50123

File tree

4 files changed

+139
-84
lines changed

4 files changed

+139
-84
lines changed

.buildkite/pipeline.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,24 @@ steps:
3434
# NIX_PATH=nixpkgs=nixpkgs nix-build --no-link survey/default.nix \
3535
# --arg integer-simple true -A working -A workingStackageExecutables
3636

37+
# Note on GHC versions:
38+
# It really only makes sense to test the compiler version matching the version
39+
# of Stackage that was the base for nixpkgs's `haskellPackages`.
40+
# Any other GHC version should be tested via `stack2nix` builds.
41+
3742
# Other
3843

3944
- label: stack2nix-example
4045
command: |
4146
cd static-stack2nix-builder-example/ && $(nix-build --no-link -A fullBuildScript)
4247
43-
# Different GHC versions
44-
45-
- label: 8.6.5 -A working
46-
command: |
47-
NIX_PATH=nixpkgs=nixpkgs nix-build --no-link survey/default.nix \
48-
--argstr compiler ghc865 -A working
49-
50-
- label: 8.6.5 -A workingStackageExecutables
51-
command: |
52-
NIX_PATH=nixpkgs=nixpkgs nix-build --no-link survey/default.nix \
53-
--argstr compiler ghc865 -A workingStackageExecutables
54-
5548
# Stack via stack2nix
5649

5750
- label: static-stack
5851
command: |
5952
cd static-stack/
6053
mkdir -p static-stack-test-dir
6154
curl -L https://github.com/commercialhaskell/stack/archive/v2.1.3.tar.gz | tar -xz -C static-stack-test-dir
55+
# Use lts-12 because ghc822 is no longer in nixpkgs
56+
cp static-stack-test-dir/stack-*/stack-lts-12.yaml static-stack-test-dir/stack-*/stack.yaml
6257
$(nix-build --no-link -A fullBuildScript --argstr stackDir $PWD/static-stack-test-dir/stack-*)

nixpkgs

Submodule nixpkgs updated 10141 files

static-stack/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}:
1010
let
1111
cabalPackageName = "stack";
12-
compiler = "ghc822"; # matching stack.yaml
12+
compiler = "ghc844"; # matching stack-lts-12.yaml
1313

1414
pkgs = import ../nixpkgs {};
1515

survey/default.nix

Lines changed: 130 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ in
3232
])."${approach}",
3333

3434
# When changing this, also change the default version of Cabal declared below
35-
compiler ? "ghc864",
35+
compiler ? "ghc865",
3636

3737
defaultCabalPackageVersionComingWithGhc ?
3838
({
3939
ghc822 = "Cabal_2_2_0_1"; # TODO this is technically incorrect for ghc 8.2.2, should be 2.0.1.0, but nixpkgs doesn't have that
4040
ghc844 = "Cabal_2_2_0_1";
4141
ghc863 = throw "static-haskell-nix: ghc863 is no longer supported, please upgrade";
42-
ghc864 = "Cabal_2_4_1_0"; # TODO this is technically incorrect for ghc 8.6.4, should be 2.4.0.1, but nixpkgs doesn't have that
42+
ghc864 = throw "static-haskell-nix: ghc863 is no longer supported, please upgrade";
4343
ghc865 = "Cabal_2_4_1_0"; # TODO this is technically incorrect for ghc 8.6.5, should be 2.4.0.1, but nixpkgs doesn't have that
44+
ghc881 = "Cabal_3_0_0_0";
4445
}."${compiler}"),
4546

4647
# Use `integer-simple` instead of `integer-gmp` to avoid linking in
@@ -338,53 +339,57 @@ let
338339
# (we include them conditionally here anyway, for the case
339340
# that the user specifies a different Cabal version e.g. via
340341
# `stack2nix`):
341-
(builtins.concatLists [
342-
# -L flag deduplication
343-
# https://github.com/haskell/cabal/pull/5356
344-
(lib.optional (pkgs.lib.versionOlder cabalDrv.version "2.4.0.0") (makeCabalPatch {
345-
name = "5356.patch";
346-
url = "https://github.com/haskell/cabal/commit/fd6ff29e268063f8a5135b06aed35856b87dd991.patch";
347-
sha256 = "1l5zwrbdrra789c2sppvdrw3b8jq241fgavb8lnvlaqq7sagzd1r";
348-
}))
349-
# Patches that as of writing aren't merged yet:
350-
]) ++ [
351-
# TODO Move this into the above section when merged in some Cabal version:
352-
# --enable-executable-static
353-
# https://github.com/haskell/cabal/pull/5446
354-
(if pkgs.lib.versionOlder cabalDrv.version "2.4.0.0"
355-
then
356-
# Older cabal, from https://github.com/nh2/cabal/commits/dedupe-more-include-and-linker-flags-enable-static-executables-flag-pass-ld-options-to-ghc-Cabal-v2.2.0.1
357-
(makeCabalPatch {
358-
name = "5446.patch";
359-
url = "https://github.com/haskell/cabal/commit/748f07b50724f2618798d200894f387020afc300.patch";
360-
sha256 = "1zmbalkdbd1xyf0kw5js74bpifhzhm16c98kn7kkgrwql1pbdyp5";
361-
})
362-
else
363-
(makeCabalPatch {
364-
name = "5446.patch";
365-
url = "https://github.com/haskell/cabal/commit/cb221c23c274f79dcab65aef3756377af113ae21.patch";
366-
sha256 = "02qalj5y35lq22f19sz3c18syym53d6bdqzbnx9f6z3m7xg591p1";
367-
})
368-
)
369-
# TODO Move this into the above section when merged in some Cabal version:
370-
# ld-option passthrough
371-
# https://github.com/haskell/cabal/pull/5451
372-
(if pkgs.lib.versionOlder cabalDrv.version "2.4.0.0"
373-
then
374-
# Older cabal, from https://github.com/nh2/cabal/commits/dedupe-more-include-and-linker-flags-enable-static-executables-flag-pass-ld-options-to-ghc-Cabal-v2.2.0.1
375-
(makeCabalPatch {
376-
name = "5451.patch";
377-
url = "https://github.com/haskell/cabal/commit/b66be72db3b34ea63144b45fcaf61822e0fade87.patch";
378-
sha256 = "0hndkfb96ry925xzx85km8y8pfv5ka5jz3jvy3m4l23jsrsd06c9";
379-
})
380-
else
381-
(makeCabalPatch {
382-
name = "5451.patch";
383-
url = "https://github.com/haskell/cabal/commit/0aeb541393c0fce6099ea7b0366c956e18937791.patch";
384-
sha256 = "0pa9r79730n1kah8x54jrd6zraahri21jahasn7k4ng30rnnidgz";
385-
})
386-
)
387-
];
342+
if pkgs.lib.versionOlder cabalDrv.version "3.0.0.0"
343+
then
344+
(builtins.concatLists [
345+
# -L flag deduplication
346+
# https://github.com/haskell/cabal/pull/5356
347+
(lib.optional (pkgs.lib.versionOlder cabalDrv.version "2.4.0.0") (makeCabalPatch {
348+
name = "5356.patch";
349+
url = "https://github.com/haskell/cabal/commit/fd6ff29e268063f8a5135b06aed35856b87dd991.patch";
350+
sha256 = "1l5zwrbdrra789c2sppvdrw3b8jq241fgavb8lnvlaqq7sagzd1r";
351+
}))
352+
# Patches that as of writing aren't merged yet:
353+
]) ++ [
354+
# TODO Move this into the above section when merged in some Cabal version:
355+
# --enable-executable-static
356+
# https://github.com/haskell/cabal/pull/5446
357+
(if pkgs.lib.versionOlder cabalDrv.version "2.4.0.0"
358+
then
359+
# Older cabal, from https://github.com/nh2/cabal/commits/dedupe-more-include-and-linker-flags-enable-static-executables-flag-pass-ld-options-to-ghc-Cabal-v2.2.0.1
360+
(makeCabalPatch {
361+
name = "5446.patch";
362+
url = "https://github.com/haskell/cabal/commit/748f07b50724f2618798d200894f387020afc300.patch";
363+
sha256 = "1zmbalkdbd1xyf0kw5js74bpifhzhm16c98kn7kkgrwql1pbdyp5";
364+
})
365+
else
366+
(makeCabalPatch {
367+
name = "5446.patch";
368+
url = "https://github.com/haskell/cabal/commit/cb221c23c274f79dcab65aef3756377af113ae21.patch";
369+
sha256 = "02qalj5y35lq22f19sz3c18syym53d6bdqzbnx9f6z3m7xg591p1";
370+
})
371+
)
372+
# TODO Move this into the above section when merged in some Cabal version:
373+
# ld-option passthrough
374+
# https://github.com/haskell/cabal/pull/5451
375+
(if pkgs.lib.versionOlder cabalDrv.version "2.4.0.0"
376+
then
377+
# Older cabal, from https://github.com/nh2/cabal/commits/dedupe-more-include-and-linker-flags-enable-static-executables-flag-pass-ld-options-to-ghc-Cabal-v2.2.0.1
378+
(makeCabalPatch {
379+
name = "5451.patch";
380+
url = "https://github.com/haskell/cabal/commit/b66be72db3b34ea63144b45fcaf61822e0fade87.patch";
381+
sha256 = "0hndkfb96ry925xzx85km8y8pfv5ka5jz3jvy3m4l23jsrsd06c9";
382+
})
383+
else
384+
(makeCabalPatch {
385+
name = "5451.patch";
386+
url = "https://github.com/haskell/cabal/commit/0aeb541393c0fce6099ea7b0366c956e18937791.patch";
387+
sha256 = "0pa9r79730n1kah8x54jrd6zraahri21jahasn7k4ng30rnnidgz";
388+
})
389+
)
390+
]
391+
# cabal >= 3.0.0.0 currently needs no patches.
392+
else [];
388393
});
389394

390395
useFixedCabal =
@@ -460,7 +465,7 @@ let
460465

461466
# Takes a curl derivation and overrides it to have both .a and .so files,
462467
# and have the `curl` executable be statically linked.
463-
statify_curl_including_exe = curl_drv:
468+
statify_curl_including_exe = curl_drv: zlib_both:
464469
(curl_drv.override (old: {
465470
# Disable gss support, because that requires `krb5`, which
466471
# (as mentioned in note [krb5 can only be static XOR shared]) is a
@@ -469,7 +474,7 @@ let
469474
# dynamically-linked `curl` binary from the overlay
470475
# `archiveFilesOverlay` below where `statify_curl_including_exe` is used.
471476
gssSupport = false;
472-
zlib = statify_zlib old.zlib;
477+
zlib = zlib_both;
473478
})).overrideAttrs (old: {
474479
dontDisableStatic = true;
475480

@@ -562,21 +567,7 @@ let
562567
zlib_both = statify_zlib previous.zlib;
563568
# Also override the original packages with a throw (which as of writing
564569
# has no effect) so we can know when the bug gets fixed in the future.
565-
acl = issue_61682_throw "acl" previous.acl;
566-
attr = issue_61682_throw "attr" previous.attr;
567-
bash = issue_61682_throw "bash" previous.bash;
568-
coreutils = issue_61682_throw "coreutils" previous.coreutils;
569-
diffutils = issue_61682_throw "diffutils" previous.diffutils;
570-
findutils = issue_61682_throw "findutils" previous.findutils;
571-
gawk = issue_61682_throw "gawk" previous.gawk;
572-
gnugrep = issue_61682_throw "gnugrep" previous.gnugrep;
573-
gnumake = issue_61682_throw "gnumake" previous.gnumake;
574-
gnupatch = issue_61682_throw "gnupatch" previous.gnupatch;
575-
gnused = issue_61682_throw "gnused" previous.gnused;
576-
gnutar = issue_61682_throw "gnutar" previous.gnutar;
577-
gzip = issue_61682_throw "gzip" previous.gzip;
578-
patchelf = issue_61682_throw "patchelf" previous.patchelf;
579-
xz = issue_61682_throw "xz" previous.xz;
570+
# [previously there were overrides here, but they stopped working, read below]
580571
# For unknown reason we can't do this check on `zlib`, because if we do, we get:
581572
#
582573
# while evaluating the attribute 'zlib_static' at /home/niklas/src/haskell/static-haskell-nix/survey/default.nix:498:5:
@@ -591,6 +582,23 @@ let
591582
# https://github.com/nh2/static-haskell-nix/issues/47.
592583
#bzip2 = issue_61682_throw "bzip2" previous.bzip2;
593584
#pcre = issue_61682_throw "pcre" previous.pcre;
585+
# Since the update to nixpkgs master for #61 also for these,
586+
# see https://github.com/NixOS/nixpkgs/issues/61682#issuecomment-544215621
587+
#acl = issue_61682_throw "acl" previous.acl;
588+
#attr = issue_61682_throw "attr" previous.attr;
589+
#bash = issue_61682_throw "bash" previous.bash;
590+
#coreutils = issue_61682_throw "coreutils" previous.coreutils;
591+
#diffutils = issue_61682_throw "diffutils" previous.diffutils;
592+
#findutils = issue_61682_throw "findutils" previous.findutils;
593+
#gawk = issue_61682_throw "gawk" previous.gawk;
594+
#gnugrep = issue_61682_throw "gnugrep" previous.gnugrep;
595+
#gnumake = issue_61682_throw "gnumake" previous.gnumake;
596+
#gnupatch = issue_61682_throw "gnupatch" previous.gnupatch;
597+
#gnused = issue_61682_throw "gnused" previous.gnused;
598+
#gnutar = issue_61682_throw "gnutar" previous.gnutar;
599+
#gzip = issue_61682_throw "gzip" previous.gzip;
600+
#patchelf = issue_61682_throw "patchelf" previous.patchelf;
601+
#xz = issue_61682_throw "xz" previous.xz;
594602

595603
postgresql = (previous.postgresql.overrideAttrs (old: { dontDisableStatic = true; })).override {
596604
# We need libpq, which does not need systemd,
@@ -652,8 +660,38 @@ let
652660
};
653661

654662
# See comments on `statify_curl_including_exe` for the interaction with krb5!
655-
curl = statify_curl_including_exe previous.curl;
663+
# As mentioned in [Packages that can't be overridden by overlays], we can't
664+
# override zlib to have static libs, so we have to pass in `zlib_both` explicitly
665+
# so that `curl` can use it.
666+
curl = statify_curl_including_exe previous.curl final.zlib_both;
667+
668+
# `fetchurl` uses our overridden `curl` above, but `fetchurl` overrides
669+
# `zlib` in `curl`, see
670+
# https://github.com/NixOS/nixpkgs/blob/4a5c0e029ddbe89aa4eb4da7949219fe4e3f8472/pkgs/top-level/all-packages.nix#L296-L299
671+
# so because of [Packages that can't be overridden by overlays],
672+
# it will undo our `zlib` override in `curl` done above (for `curl`
673+
# use via `fetchurl`).
674+
# So we need to explicitly put our zlib into that one's curl here.
675+
fetchurl = previous.fetchurl.override (old: {
676+
# Can't use `zlib_both` here (infinite recursion), so we
677+
# re-`statify_zlib` `final.zlib` here (interesting that
678+
# `previous.zlib` also leads to infinite recursion at time of writing).
679+
curl = old.curl.override { zlib = statify_zlib final.zlib; };
680+
});
656681

682+
R = (previous.R.override {
683+
# R supports EITHER static or shared libs.
684+
static = true;
685+
# The Haskell package `H` depends on R, which pulls in OpenJDK,
686+
# which is not patched for musl support yet in nixpkgs.
687+
# Disable Java support for now.
688+
javaSupport = false;
689+
}).overrideAttrs (old: {
690+
# Testsuite newly seems to have at least one segfaulting test case.
691+
# Disable test suite for now; Alpine also does it:
692+
# https://git.alpinelinux.org/aports/tree/community/R/APKBUILD?id=e2bce14c748aacb867713cb81a91fad6e8e7f7f6#n56
693+
doCheck = false;
694+
});
657695
};
658696

659697

@@ -945,8 +983,21 @@ let
945983
];
946984
}))).override { openblasCompat = final.openblasCompat; };
947985

986+
# Test suite segfaults (perhaps because R's test suite also does?).
987+
inline-r = dontCheck super.inline-r;
988+
948989
# TODO For the below packages, it would be better if we could somehow make all users
949990
# of postgresql-libpq link in openssl via pkgconfig.
991+
pg-harness-server =
992+
addStaticLinkerFlagsWithPkgconfig
993+
super.pg-harness-server
994+
[ final.openssl final.postgresql ]
995+
"--libs libpq";
996+
postgresql-orm =
997+
addStaticLinkerFlagsWithPkgconfig
998+
super.postgresql-orm
999+
[ final.openssl final.postgresql ]
1000+
"--libs libpq";
9501001
postgresql-schema =
9511002
addStaticLinkerFlagsWithPkgconfig
9521003
super.postgresql-schema
@@ -1052,13 +1103,20 @@ let
10521103
then disableCabalFlag super.cryptonite "integer-gmp"
10531104
else super.cryptonite;
10541105

1055-
# The test-suite `test-scientific`'s loops forver on 100% CPU with integer-simple
1106+
# The test-suite of this package loops forever on 100% CPU (at least on `-O0`).
1107+
bench-show = dontCheck super.bench-show;
1108+
# The test-suite of this package loops forever on 100% CPU (at least on `-O0`).
1109+
# TODO Investigate that because `loop` is nh2's own package.
1110+
loop = dontCheck super.loop;
1111+
# The test-suite of this package loops forever on 100% CPU (at least on `-O0`).
1112+
matrix = dontCheck super.matrix;
1113+
# The test-suite of this package loops forever on 100% CPU (at least on `-O0`).
10561114
# TODO Ask Bas about it
10571115
scientific =
10581116
if integer-simple
10591117
then dontCheck super.scientific
10601118
else super.scientific;
1061-
# The test-suite `test-x509-validation`'s loops forver on 100% CPU with integer-simple
1119+
# The test-suite of this package loops forever on 100% CPU (at least on `-O0`).
10621120
x509-validation =
10631121
if integer-simple
10641122
then dontCheck super.x509-validation
@@ -1137,7 +1195,7 @@ in
11371195
# There's probably a lack of dead-code elimination with `pkgsStatic`,
11381196
# but even if that worked, this is odd because this should work even
11391197
# when you *use* the `binDir` thing in your executable.
1140-
cachix
1198+
# cachix # fails on latest nixpkgs master due to cachix -> nix -> pkgsStatic.busybox dependency, see https://github.com/nh2/static-haskell-nix/pull/61#issuecomment-544331652
11411199
# darcs fails on `pkgsStatic` because
11421200
darcs # Has native dependencies (`libcurl` and its dependencies)
11431201
# pandoc fails on `pkgsStatic` because Lua doesn't currently build there.
@@ -1176,6 +1234,7 @@ in
11761234
"ersatz"
11771235
"gloss-examples" # needs opengl
11781236
"gtk3" # problem compiling `glib` dependency with `Distribution.Simple.UserHooks.UserHooks` type mismatch across Cabal versions; should go away once we no longer have to patch Cabal
1237+
"H" # `zgemm_: symbol not found` when compiling Main; not clear how that can be provided
11791238
"hamilton" # openmp linker error via openblas
11801239
"hquantlib"
11811240
"ihaskell"
@@ -1187,6 +1246,7 @@ in
11871246
"odbc" # undeclared `<odbcss.h>` dependency
11881247
"OpenAL" # transitively depends on `systemd`, which doesn't build with musl
11891248
"qchas" # openmp linker error via openblas
1249+
"rhine-gloss" # needs opengl
11901250
"sdl2" # transitively depends on `systemd`, which doesn't build with musl
11911251
"sdl2-gfx" # see `sdl2`
11921252
"sdl2-image" # see `sdl2`

0 commit comments

Comments
 (0)