diff --git a/.gitmodules b/.gitmodules index 7b12849..597165b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "nixpkgs"] path = nixpkgs - url = https://github.com/nh2/nixpkgs.git + url = https://github.com/NixOS/nixpkgs.git diff --git a/default.nix b/default.nix index ef58216..3fc7fe7 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ # Note: This is just a minimal example. For proper usage, see the README. -{ nixpkgs ? (import ./nixpkgs.nix).pkgsMusl, compiler ? "ghc864", strip ? true }: +{ nixpkgs ? (import ./nixpkgs.nix).pkgsMusl, compiler ? "ghc8107", strip ? true }: let @@ -12,7 +12,7 @@ let pname = "example-scotty-app"; version = "0.1.0.0"; src = pkgs.lib.sourceByRegex ./. [ - ".*\.cabal$" + ".*\\.cabal$" "^Setup.hs$" "^Main.hs$" ]; @@ -21,7 +21,7 @@ let enableSharedExecutables = false; enableSharedLibraries = false; executableHaskellDepends = [ base scotty ]; - license = stdenv.lib.licenses.bsd3; + license = pkgs.lib.licenses.bsd3; configureFlags = [ "--ghc-option=-optl=-static" "--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib" @@ -37,7 +37,6 @@ let haskellPackages = with pkgs.haskell.lib; normalHaskellPackages.override { overrides = self: super: { # Dependencies we need to patch - hpc-coveralls = appendPatch super.hpc-coveralls (builtins.fetchurl https://github.com/guillaume-nargeot/hpc-coveralls/pull/73/commits/344217f513b7adfb9037f73026f5d928be98d07f.patch); }; }; diff --git a/nixpkgs b/nixpkgs index d00b5a5..5730959 160000 --- a/nixpkgs +++ b/nixpkgs @@ -1 +1 @@ -Subproject commit d00b5a5fa6fe8bdf7005abb06c46ae0245aec8b5 +Subproject commit 573095944e7c1d58d30fc679c81af63668b54056 diff --git a/nixpkgs.nix b/nixpkgs.nix index 18eb9c9..75886cd 100644 --- a/nixpkgs.nix +++ b/nixpkgs.nix @@ -25,4 +25,5 @@ if builtins.getEnv "STATIC_HASKELL_NIX_CI_NIXPKGS_UNSTABLE_BUILD" == "1" if builtins.pathExists ./nixpkgs/pkgs then import ./nixpkgs {} # Pinned nixpkgs version; should be kept up-to-date with our submodule. - else import (fetchTarball https://github.com/NixOS/nixpkgs/archive/d00b5a5fa6fe8bdf7005abb06c46ae0245aec8b5.tar.gz) {} + # This is nixos-21.11 as of 2021-12-15. + else import (fetchTarball https://github.com/NixOS/nixpkgs/archive/573095944e7c1d58d30fc679c81af63668b54056.tar.gz) {} diff --git a/survey/default.nix b/survey/default.nix index 46d8066..bdcb8fa 100644 --- a/survey/default.nix +++ b/survey/default.nix @@ -22,12 +22,13 @@ in ])."${approach}", # When changing this, also change the default version of Cabal declared below - compiler ? "ghc8104", + compiler ? "ghc8107", # See: # * https://www.snoyman.com/base/ # * https://www.haskell.org/cabal/download.html # section "Older Releases" + # * https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history defaultCabalPackageVersionComingWithGhc ? ({ 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 @@ -38,6 +39,7 @@ in ghc881 = "Cabal_3_0_0_0"; ghc8104 = "Cabal_3_2_1_0"; ghc8105 = "Cabal_3_2_1_0"; + ghc8107 = "Cabal_3_2_1_0"; ghc901 = "Cabal_3_4_0_0"; }."${compiler}"), @@ -505,6 +507,7 @@ let # `archiveFilesOverlay` below where `statify_curl_including_exe` is used. gssSupport = false; zlib = zlib_both; + brotliSupport = false; })).overrideAttrs (old: { dontDisableStatic = true; @@ -653,7 +656,12 @@ let #patchelf = issue_61682_throw "patchelf" previous.patchelf; #xz = issue_61682_throw "xz" previous.xz; - postgresql = (previous.postgresql.overrideAttrs (old: { dontDisableStatic = true; })).override { + # The test-suite for PostgreSQL 13 fails: + # https://github.com/NixOS/nixpkgs/issues/150930 + # + # Even if you disable the test-suite, there are various linking issues. + # PostgreSQL 12 has similar issues, so we drop to PostgreSQL 11. + postgresql = (previous.postgresql_11.overrideAttrs (old: { dontDisableStatic = true; })).override { # We need libpq, which does not need systemd, # and systemd doesn't currently build with musl. enableSystemd = false; @@ -731,7 +739,17 @@ let libjpeg = previous.libjpeg.override (old: { enableStatic = true; }); libjpeg_turbo = previous.libjpeg_turbo.override (old: { enableStatic = true; }); - openblas = previous.openblas.override { enableStatic = true; }; + openblas = (previous.openblas.override { enableStatic = true; }).overrideAttrs (old: { + # openblas doesn't create symlinks for static archives like libblas.a and + # liblapack.a. The following lines fixes this. + # https://github.com/NixOS/nixpkgs/pull/151049 + postInstall = old.postInstall + '' + ln -s $out/lib/libopenblas.a $out/lib/libblas.a + ln -s $out/lib/libopenblas.a $out/lib/libcblas.a + ln -s $out/lib/libopenblas.a $out/lib/liblapack.a + ln -s $out/lib/libopenblas.a $out/lib/liblapacke.a + ''; + }); openssl = previous.openssl.override { static = true; }; @@ -763,6 +781,9 @@ let # so that `curl` can use it. curl = statify_curl_including_exe previous.curl final.zlib_both; + # curlMinimal also needs to be statified. + curlMinimal = statify_curl_including_exe previous.curlMinimal final.zlib_both; + # `fetchurl` uses our overridden `curl` above, but `fetchurl` overrides # `zlib` in `curl`, see # https://github.com/NixOS/nixpkgs/blob/4a5c0e029ddbe89aa4eb4da7949219fe4e3f8472/pkgs/top-level/all-packages.nix#L296-L299 @@ -832,6 +853,21 @@ let }; }; + # I'm not sure why this is needed. As far as I can tell, libdevil doesn't + # directly link to libdeflate. But libdevil does link to libtiff, which + # uses libdeflate. + # + # However, if libdevil doesn't have libdeflate as a buildInput, building + # libdevil fails with linking errors. + # + # I wasn't able to report this upstream, because in nixpkgs libdevil and + # pkgsMusl.libdevil build correctly. Some transitive dependencies for + # pkgsStatic.libdevil fail to build, so it is hard to say whether this is a + # static-haskell-nix problem, or just a static-linking problem. + libdevil = previous.libdevil.overrideAttrs (oldAttrs: { + buildInputs = oldAttrs.buildInputs ++ [ final.libdeflate ]; + }); + }; @@ -1186,6 +1222,13 @@ let # Tests fail with: doctests: : Dynamic loading not supported headroom = dontCheck super.headroom; + # We need to explicitly get blas from openblasCompat, since + # otherwise openblas is used and Haskell programs like `resistor-cube` + # won't be able to find libblas. + blas-ffi = super.blas-ffi.override { + blas = final.openblasCompat; + }; + hmatrix = # musl does not have `random_r()`. (enableCabalFlag super.hmatrix "no-random_r") @@ -1624,6 +1667,7 @@ in "LambdaHack" # fails `systemd` dependency erroring on `#include ` "language-puppet" # `base >=4.6 && <4.14, ghc-prim >=0.3 && <0.6` for dependency `protolude` "learn-physics" # needs opengl: `cannot find -lGLU` `-lGL` + "magico" # undefined reference to `_gfortran_concat_string' "odbc" # `odbcss.h: No such file or directory` "qchas" # `_gfortran_concat_string` linker error via openblas "rhine-gloss" # needs opengl: `cannot find -lGLU` `-lGL`