From 11e6deef81954b30e7e208aaa50f13b0de465e4c Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Mon, 16 Jun 2025 13:28:30 -0400 Subject: [PATCH 1/9] REWORDME: Drop GHC 8.10.7 and update haskell.nix --- flake.lock | 309 ++++++++++++++++++++--------------------------------- flake.nix | 70 +++--------- 2 files changed, 131 insertions(+), 248 deletions(-) diff --git a/flake.lock b/flake.lock index ed6c8e283..a5bec7abd 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1748021818, - "narHash": "sha256-MwSc2+UaaOkLosZ6mtgJBoxeasgVp8+7HoEcGCyxjJY=", + "lastModified": 1749727790, + "narHash": "sha256-yCKoVpny9PSGTcSrCtXq77FuKFlq9Hf81ULVgCvkfmc=", "owner": "IntersectMBO", "repo": "cardano-haskell-packages", - "rev": "3a8a6e6a49b4fd3fc5c7778b9160ef4e54400a1e", + "rev": "b1b559392d6fc44626cef9d5b7821421cc7adcdc", "type": "github" }, "original": { @@ -168,14 +168,31 @@ "type": "github" } }, + "hackage-for-stackage": { + "flake": false, + "locked": { + "lastModified": 1749774401, + "narHash": "sha256-JEe6dWi1OGi+XmmcM7WLETKjXCfvJoxNyxXbH3RtQTk=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "31f4603510e68b62a437436de8d8117952110c80", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "for-stackage", + "repo": "hackage.nix", + "type": "github" + } + }, "hackageNix": { "flake": false, "locked": { - "lastModified": 1748219218, - "narHash": "sha256-kKe1cGUGkwp/6704BTKlH4yWTL0wmZugofJU20PcIkA=", + "lastModified": 1749774401, + "narHash": "sha256-JEe6dWi1OGi+XmmcM7WLETKjXCfvJoxNyxXbH3RtQTk=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "d3c929097030b8405f983de59ea243018d7cf877", + "rev": "31f4603510e68b62a437436de8d8117952110c80", "type": "github" }, "original": { @@ -197,8 +214,12 @@ "hackage": [ "hackageNix" ], + "hackage-for-stackage": "hackage-for-stackage", + "hls": "hls", "hls-1.10": "hls-1.10", "hls-2.0": "hls-2.0", + "hls-2.10": "hls-2.10", + "hls-2.11": "hls-2.11", "hls-2.2": "hls-2.2", "hls-2.3": "hls-2.3", "hls-2.4": "hls-2.4", @@ -208,30 +229,26 @@ "hls-2.8": "hls-2.8", "hls-2.9": "hls-2.9", "hpc-coveralls": "hpc-coveralls", - "hydra": "hydra", "iserv-proxy": "iserv-proxy", "nixpkgs": [ "haskellNix", "nixpkgs-unstable" ], - "nixpkgs-2003": "nixpkgs-2003", - "nixpkgs-2105": "nixpkgs-2105", - "nixpkgs-2111": "nixpkgs-2111", - "nixpkgs-2205": "nixpkgs-2205", - "nixpkgs-2211": "nixpkgs-2211", "nixpkgs-2305": "nixpkgs-2305", "nixpkgs-2311": "nixpkgs-2311", "nixpkgs-2405": "nixpkgs-2405", + "nixpkgs-2411": "nixpkgs-2411", + "nixpkgs-2505": "nixpkgs-2505", "nixpkgs-unstable": "nixpkgs-unstable", "old-ghc-nix": "old-ghc-nix", "stackage": "stackage" }, "locked": { - "lastModified": 1729471867, - "narHash": "sha256-xMxD8YQGGcbrZGHJws32UvtWJxfhzAO7yzPs5TjiOPY=", + "lastModified": 1749775931, + "narHash": "sha256-QqGO7q/CE7RI6eHQsqALY361C69jcSrdqTPuy8b1mes=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "03c3581d2e0c91f7c2690115b487961ad62099a6", + "rev": "3c3eb1cdd3e394fec7755ddf18678a23846dac61", "type": "github" }, "original": { @@ -240,6 +257,22 @@ "type": "github" } }, + "hls": { + "flake": false, + "locked": { + "lastModified": 1741604408, + "narHash": "sha256-tuq3+Ip70yu89GswZ7DSINBpwRprnWnl6xDYnS4GOsc=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "682d6894c94087da5e566771f25311c47e145359", + "type": "github" + }, + "original": { + "owner": "haskell", + "repo": "haskell-language-server", + "type": "github" + } + }, "hls-1.10": { "flake": false, "locked": { @@ -274,6 +307,40 @@ "type": "github" } }, + "hls-2.10": { + "flake": false, + "locked": { + "lastModified": 1743069404, + "narHash": "sha256-q4kDFyJDDeoGqfEtrZRx4iqMVEC2MOzCToWsFY+TOzY=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "2318c61db3a01e03700bd4b05665662929b7fe8b", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.10.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.11": { + "flake": false, + "locked": { + "lastModified": 1747306193, + "narHash": "sha256-/MmtpF8+FyQlwfKHqHK05BdsxC9LHV70d/FiMM7pzBM=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "46ef4523ea4949f47f6d2752476239f1c6d806fe", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.11.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, "hls-2.2": { "flake": false, "locked": { @@ -396,11 +463,11 @@ "hls-2.9": { "flake": false, "locked": { - "lastModified": 1720003792, - "narHash": "sha256-qnDx8Pk0UxtoPr7BimEsAZh9g2WuTuMB/kGqnmdryKs=", + "lastModified": 1719993701, + "narHash": "sha256-wy348++MiMm/xwtI9M3vVpqj2qfGgnDcZIGXw8sF1sA=", "owner": "haskell", "repo": "haskell-language-server", - "rev": "0c1817cb2babef0765e4e72dd297c013e8e3d12b", + "rev": "90319a7e62ab93ab65a95f8f2bcf537e34dae76a", "type": "github" }, "original": { @@ -426,29 +493,6 @@ "type": "github" } }, - "hydra": { - "inputs": { - "nix": "nix", - "nixpkgs": [ - "haskellNix", - "hydra", - "nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1671755331, - "narHash": "sha256-hXsgJj0Cy0ZiCiYdW2OdBz5WmFyOMKuw4zyxKpgUKm4=", - "owner": "NixOS", - "repo": "hydra", - "rev": "f48f00ee6d5727ae3e488cbf9ce157460853fea8", - "type": "github" - }, - "original": { - "id": "hydra", - "type": "indirect" - } - }, "iohkNix": { "inputs": { "blst": "blst", @@ -475,11 +519,11 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1717479972, - "narHash": "sha256-7vE3RQycHI1YT9LHJ1/fUaeln2vIpYm6Mmn8FTpYeVo=", + "lastModified": 1749443511, + "narHash": "sha256-asfdanBoIUcJ9XQWB3a/5wQGFG/6Uq6l2s9r8OuamkY=", "owner": "stable-haskell", "repo": "iserv-proxy", - "rev": "2ed34002247213fc435d0062350b91bab920626e", + "rev": "e40eddb1ca1e3e906e018c7e6b0d1e51c930ec9d", "type": "github" }, "original": { @@ -489,139 +533,6 @@ "type": "github" } }, - "lowdown-src": { - "flake": false, - "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", - "type": "github" - }, - "original": { - "owner": "kristapsdz", - "repo": "lowdown", - "type": "github" - } - }, - "nix": { - "inputs": { - "lowdown-src": "lowdown-src", - "nixpkgs": "nixpkgs", - "nixpkgs-regression": "nixpkgs-regression" - }, - "locked": { - "lastModified": 1661606874, - "narHash": "sha256-9+rpYzI+SmxJn+EbYxjGv68Ucp22bdFUSy/4LkHkkDQ=", - "owner": "NixOS", - "repo": "nix", - "rev": "11e45768b34fdafdcf019ddbd337afa16127ff0f", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "2.11.0", - "repo": "nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1657693803, - "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.05-small", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2003": { - "locked": { - "lastModified": 1620055814, - "narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-20.03-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2105": { - "locked": { - "lastModified": 1659914493, - "narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-21.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2111": { - "locked": { - "lastModified": 1659446231, - "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-21.11-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2205": { - "locked": { - "lastModified": 1685573264, - "narHash": "sha256-Zffu01pONhs/pqH07cjlF10NnMDLok8ix5Uk4rhOnZQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "380be19fbd2d9079f677978361792cb25e8a3635", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-22.05-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-2211": { - "locked": { - "lastModified": 1688392541, - "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-22.11-darwin", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-2305": { "locked": { "lastModified": 1705033721, @@ -656,11 +567,11 @@ }, "nixpkgs-2405": { "locked": { - "lastModified": 1726447378, - "narHash": "sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ=", + "lastModified": 1735564410, + "narHash": "sha256-HB/FA0+1gpSs8+/boEavrGJH+Eq08/R2wWNph1sM1Dg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "086b448a5d54fd117f4dc2dee55c9f0ff461bdc1", + "rev": "1e7a8f391f1a490460760065fa0630b5520f9cf8", "type": "github" }, "original": { @@ -670,29 +581,45 @@ "type": "github" } }, - "nixpkgs-regression": { + "nixpkgs-2411": { + "locked": { + "lastModified": 1748037224, + "narHash": "sha256-92vihpZr6dwEMV6g98M5kHZIttrWahb9iRPBm1atcPk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f09dede81861f3a83f7f06641ead34f02f37597f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-24.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2505": { "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "lastModified": 1748852332, + "narHash": "sha256-r/wVJWmLYEqvrJKnL48r90Wn9HWX9SHFt6s4LhuTh7k=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "rev": "a8167f3cc2f991dd4d0055746df53dae5fd0c953", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixpkgs-25.05-darwin", "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1726583932, - "narHash": "sha256-zACxiQx8knB3F8+Ze+1BpiYrI+CbhxyWpcSID9kVhkQ=", + "lastModified": 1748856973, + "narHash": "sha256-RlTsJUvvr8ErjPBsiwrGbbHYW8XbB/oek0Gi78XdWKg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "658e7223191d2598641d50ee4e898126768fe847", + "rev": "e4b09e47ace7d87de083786b404bf232eb6c89d8", "type": "github" }, "original": { @@ -787,11 +714,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1729039017, - "narHash": "sha256-fGExfgG+7UNSOV8YfOrWPpOHWrCjA02gQkeSBhaAzjQ=", + "lastModified": 1749773622, + "narHash": "sha256-fFKX356VvLP+IbHcKy46qEQjqNqKLYtOcski2Xqpeww=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "df1d8f0960407551fea7af7af75a9c2f9e18de97", + "rev": "d8aa8ec01f62aaea09d62ff0f663866831074f2c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a8740c52f..18c8061c8 100644 --- a/flake.nix +++ b/flake.nix @@ -77,19 +77,13 @@ }) (final: prev: { - # HLint 3.2.x requires GHC >= 8.10 && < 9.0 - hlint = final.haskell-nix.tool "ghc8107" "hlint" { - version = "3.2.7"; + hlint = final.haskell-nix.tool "ghc96" "hlint" { + version = "latest"; }; # Fourmolu 0.10.x requires GHC >= 9.0 && < 9.6 - fourmolu = final.haskell-nix.tool "ghc928" "fourmolu" { - version = "0.10.1.0"; - }; - - # Weeder 2.2.0 requires GHC >= 8.10 && < 9.0 - weeder = final.haskell-nix.tool "ghc8107" "weeder" { - version = "2.2.0"; + fourmolu = final.haskell-nix.tool "ghc96" "fourmolu" { + version = "latest"; }; }) @@ -156,17 +150,10 @@ project = (nixpkgs.haskell-nix.cabalProject' ({ config, lib, pkgs, ... }: rec { src = ./.; name = "cardano-db-sync"; - compiler-nix-name = - if system == "x86_64-linux" - then lib.mkDefault "ghc810" - else lib.mkDefault "ghc96"; + compiler-nix-name = lib.mkDefault "ghc96"; flake.variants = let - compilers = - if (system == "x86_64-linux") then - ["ghc96" "ghc98" "ghc910"] - else - ["ghc98"]; + compilers = [ "ghc98" "ghc910" "ghc912" ]; in lib.genAttrs compilers (c: { compiler-nix-name = c; }); @@ -187,38 +174,26 @@ shell.tools = { cabal = "latest"; + fourmolu = "latest"; haskell-language-server = { - src = - if config.compiler-nix-name == "ghc8107" then - nixpkgs.haskell-nix.sources."hls-1.10" - else - nixpkgs.haskell-nix.sources."hls-2.9"; + src = nixpkgs.haskell-nix.sources."hls-2.11"; }; + hlint = "latest"; + } // lib.optionalAttrs (config.compiler-nix-name == "ghc966") { + weeder = "latest"; }; # Now we use pkgsBuildBuild, to make sure that even in the cross # compilation setting, we don't run into issues where we pick tools # for the target. shell.buildInputs = with nixpkgs.pkgsBuildBuild; [ gitAndTools.git - hlint - ] ++ lib.optionals (config.compiler-nix-name == "ghc8107") [ - # Weeder requires the GHC version to match HIE files - weeder - ] ++ lib.optionals (system != "aarch64-darwin") [ - # TODO: Fourmolu 0.10 is currently failing to build with aarch64-darwin - # - # Linking dist/build/fourmolu/fourmolu ... - # ld: line 269: 2352 Segmentation fault ... - # clang-11: error: linker command failed with exit code 139 (use -v to see invocation) - # `cc' failed in phase `Linker'. (Exit code: 139) - fourmolu ]; shell.withHoogle = true; shell.crossPlatforms = _: []; modules = [ ({ lib, pkgs, ... }: { - package-keys = ["ekg"]; + package-keys = [ "ekg" ]; # Ignore version bounds packages.katip.doExactConfig = true; # Split data to reduce closure size @@ -243,27 +218,8 @@ }) - ({ lib, config, ... }: - # Disable haddock on 8.x - lib.mkIf (lib.versionOlder config.compiler.version "9") { - packages.cardano-ledger-alonzo.doHaddock = false; - packages.cardano-ledger-allegra.doHaddock = false; - packages.cardano-ledger-api.doHaddock = false; - packages.cardano-ledger-babbage.doHaddock = false; - packages.cardano-ledger-conway.doHaddock = false; - packages.cardano-ledger-shelley.doHaddock = false; - packages.cardano-protocol-tpraos.doHaddock = false; - packages.fs-api.doHaddock = false; - packages.ouroboros-network-framework.doHaddock = false; - packages.ouroboros-consensus-cardano.doHaddock = false; - packages.ouroboros-consensus.doHaddock = false; - packages.cardano-ledger-core.doHaddock = false; - packages.plutus-ledger-api.doHaddock = false; - packages.wai-extra.doHaddock = false; - }) - ({ lib, pkgs, config, ... }: - lib.mkIf (lib.versionAtLeast config.compiler.version "9.4") { + ({ lib, pkgs, config, ... }: { # lib:ghc is a bit annoying in that it comes with it's own build-type:Custom, and then tries # to call out to all kinds of silly tools that GHC doesn't really provide. # For this reason, we try to get away without re-installing lib:ghc for now. From 5ab0a5d962a40a8be2972ab27b708d339b86fd26 Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Mon, 16 Jun 2025 14:53:55 -0400 Subject: [PATCH 2/9] build(nix): iproute => iproute2 --- nix/docker.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/docker.nix b/nix/docker.nix index f9aa78d55..ea10ce549 100644 --- a/nix/docker.nix +++ b/nix/docker.nix @@ -9,7 +9,7 @@ , bashInteractive, cacert, cardano-cli, cardano-db-sync, cardano-db-tool , cardano-smash-server, coreutils, curl, findutils, getconf, glibcLocales -, gnused, gnutar, gzip, jq, iana-etc, iproute, iputils, lib, libidn, libpqxx +, gnused, gnutar, gzip, jq, iana-etc, iproute2, iputils, lib, libidn, libpqxx , postgresql_17, socat, utillinux }: @@ -45,7 +45,7 @@ let gzip # Gnuzip jq # JSON processor iana-etc # IANA protocol and port number assignments - iproute # Utilities for controlling TCP/IP networking + iproute2 # Utilities for controlling TCP/IP networking iputils # Useful utilities for Linux networking libidn # Library for internationalized domain names libpqxx # A C++ library to access PostgreSQL databases From 0df8ec69f7de9655a056d1b2253b76e3887282cb Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Wed, 25 Jun 2025 15:47:06 -0400 Subject: [PATCH 3/9] build(nix): Swap postgresql->libpq for static builds --- flake.lock | 58 +++++++++++++++++++++++++-------------------------- flake.nix | 61 ++++++++++++++++++++++++++++-------------------------- 2 files changed, 61 insertions(+), 58 deletions(-) diff --git a/flake.lock b/flake.lock index a5bec7abd..6cbd83117 100644 --- a/flake.lock +++ b/flake.lock @@ -171,11 +171,11 @@ "hackage-for-stackage": { "flake": false, "locked": { - "lastModified": 1749774401, - "narHash": "sha256-JEe6dWi1OGi+XmmcM7WLETKjXCfvJoxNyxXbH3RtQTk=", + "lastModified": 1750552134, + "narHash": "sha256-KC/e7tQOID9SgRkmH3BNlnPZ7sn3v5k5GyllLmSZicY=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "31f4603510e68b62a437436de8d8117952110c80", + "rev": "a5d60b2d3c435cf26848e34b92e28f96e13cde7c", "type": "github" }, "original": { @@ -185,6 +185,22 @@ "type": "github" } }, + "hackage-internal": { + "flake": false, + "locked": { + "lastModified": 1750307553, + "narHash": "sha256-iiafNoeLHwlSLQTyvy8nPe2t6g5AV4PPcpMeH/2/DLs=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "f7867baa8817fab296528f4a4ec39d1c7c4da4f3", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "hackage.nix", + "type": "github" + } + }, "hackageNix": { "flake": false, "locked": { @@ -215,6 +231,7 @@ "hackageNix" ], "hackage-for-stackage": "hackage-for-stackage", + "hackage-internal": "hackage-internal", "hls": "hls", "hls-1.10": "hls-1.10", "hls-2.0": "hls-2.0", @@ -244,11 +261,11 @@ "stackage": "stackage" }, "locked": { - "lastModified": 1749775931, - "narHash": "sha256-QqGO7q/CE7RI6eHQsqALY361C69jcSrdqTPuy8b1mes=", + "lastModified": 1750665090, + "narHash": "sha256-IUGsndRxeVge1tcBZbUwy5IYV2nB2XBXFiY2qqY7HKI=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "3c3eb1cdd3e394fec7755ddf18678a23846dac61", + "rev": "78ebf39d6f8386718b16f6cfc096232a4d42d34c", "type": "github" }, "original": { @@ -519,11 +536,11 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1749443511, - "narHash": "sha256-asfdanBoIUcJ9XQWB3a/5wQGFG/6Uq6l2s9r8OuamkY=", + "lastModified": 1750543273, + "narHash": "sha256-WaswH0Y+Fmupvv8AkIlQBlUy/IdD3Inx9PDuE+5iRYY=", "owner": "stable-haskell", "repo": "iserv-proxy", - "rev": "e40eddb1ca1e3e906e018c7e6b0d1e51c930ec9d", + "rev": "a53c57c9a8d22a66a2f0c4c969e806da03f08c28", "type": "github" }, "original": { @@ -629,22 +646,6 @@ "type": "github" } }, - "nixpkgsUpstream": { - "locked": { - "lastModified": 1737942377, - "narHash": "sha256-8Eo/jRAgT3CbAloyqOj6uPN1EqBvLI/Tv2g+RxHjkhU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "88a55dffa4d44d294c74c298daf75824dc0aafb5", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "old-ghc-nix": { "flake": false, "locked": { @@ -673,7 +674,6 @@ "haskellNix", "nixpkgs-unstable" ], - "nixpkgsUpstream": "nixpkgsUpstream", "utils": "utils" } }, @@ -714,11 +714,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1749773622, - "narHash": "sha256-fFKX356VvLP+IbHcKy46qEQjqNqKLYtOcski2Xqpeww=", + "lastModified": 1750292027, + "narHash": "sha256-rmEsCxLWS/rAdIzZPSi0XbrY2BOztBlSHQHgYoXyovU=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "d8aa8ec01f62aaea09d62ff0f663866831074f2c", + "rev": "3f8c717e24953914821f1ddb4797dd768326faa6", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 18c8061c8..86c3c07c8 100644 --- a/flake.nix +++ b/flake.nix @@ -24,10 +24,6 @@ url = "github:IntersectMBO/cardano-haskell-packages?ref=repo"; flake = false; }; - # Note[PostgreSQL 17]: This is a workaround to get postgresql_17 from nixpkgs. It's - # available in nixpkgs unstable, but has not been updated in haskell.nix yet. Remove - # this after the next time haskell.nix updates nixpkgs. - nixpkgsUpstream.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; outputs = { self, ... }@inputs: @@ -40,12 +36,6 @@ in inputs.utils.lib.eachSystem supportedSystems (system: let - # TODO: Remove me (See Note[PostgreSQL 17]). - nixpkgsUpstream = import inputs.nixpkgsUpstream { - inherit system; - inherit (inputs.haskellNix) config; - }; - nixpkgs = import inputs.nixpkgs { inherit system; inherit (inputs.haskellNix) config; @@ -54,6 +44,14 @@ builtins.attrValues inputs.iohkNix.overlays ++ [ inputs.haskellNix.overlay + (final: prev: { + haskell-nix = prev.haskell-nix // { + extraPkgconfigMappings = prev.haskell-nix.extraPkgconfigMappings // { + "libpq" = [ "libpq" ]; + }; + }; + }) + (final: prev: { inherit (project.hsPkgs.cardano-node.components.exes) cardano-node; inherit (project.hsPkgs.cardano-cli.components.exes) cardano-cli; @@ -88,18 +86,23 @@ }) (final: prev: { - postgresql = prev.postgresql.overrideAttrs (_: - final.lib.optionalAttrs (final.stdenv.hostPlatform.isMusl) { - NIX_LDFLAGS = "--push-state --as-needed -lstdc++ --pop-state"; - LC_CTYPE = "C"; - - doCheck = false; - }); - }) - - # TODO: Remove me (See Note[PostgreSQL 17]) - (final: prev: { - postgresql_17 = nixpkgsUpstream.postgresql_17; + libpq = + final.lib.pipe prev.libpq [ + (p: p.override { + gssSupport = false; + }) + + (p: p.overrideAttrs (old: + final.lib.optionalAttrs (final.stdenv.hostPlatform.isMusl) { + dontDisableStatic = true; + NIX_LDFLAGS = "--push-state --as-needed -lstdc++ --pop-state"; + # without this collate.icu.utf8, and foreign_data will fail. + LC_CTYPE = "C"; + # libpq from nixpkgs will either remove static or dynamic + # libs, but we need to keep them both + postInstall = ""; + })) + ]; }) ]; }; @@ -165,7 +168,7 @@ crossPlatforms = p: lib.optional (system == "x86_64-linux") p.musl64 ++ lib.optional - (system == "x86_64-linux" && config.compiler-nix-name == "ghc966") + (system == "x86_64-linux" && config.compiler-nix-name == "ghc967") p.aarch64-multiplatform-musl; inputMap = { @@ -179,7 +182,7 @@ src = nixpkgs.haskell-nix.sources."hls-2.11"; }; hlint = "latest"; - } // lib.optionalAttrs (config.compiler-nix-name == "ghc966") { + } // lib.optionalAttrs (config.compiler-nix-name == "ghc967") { weeder = "latest"; }; # Now we use pkgsBuildBuild, to make sure that even in the cross @@ -243,14 +246,14 @@ (pkgs.lib.mkIf pkgs.hostPlatform.isMusl (let ghcOptions = [ - # Postgresql static is pretty broken in nixpkgs. We can't rely on the + # libpq static is pretty broken in nixpkgs. We can't rely on the # pkg-config, so we have to add the correct libraries ourselves - "-L${pkgs.postgresql}/lib" - "-optl-Wl,-lpgport" "-optl-Wl,-lpgcommon" + "-optl-Wl,-lpgport" + "-optl-Wl,-lm" - # Since we aren't using the postgresql pkg-config, it won't - # automatically include OpenSSL + # Since we aren't using pkg-config, it won't automatically include + # OpenSSL "-L${pkgs.openssl.out}/lib" # The ordering of -lssl and -lcrypto below is important. Otherwise, From 01a312cee5cd25709cadfec5a81e58f2814ec270 Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Fri, 27 Jun 2025 11:13:58 -0400 Subject: [PATCH 4/9] build(nix): Try to limit MacOS jobs --- flake.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 86c3c07c8..e553955ab 100644 --- a/flake.nix +++ b/flake.nix @@ -156,9 +156,12 @@ compiler-nix-name = lib.mkDefault "ghc96"; flake.variants = let - compilers = [ "ghc98" "ghc910" "ghc912" ]; + extraCompilers = + # To avoid excessive jobs, only build for default compiler on macOS + lib.optionals (system == "x86_64-linux") + [ "ghc910" "ghc912" ]; in - lib.genAttrs compilers (c: { compiler-nix-name = c; }); + lib.genAttrs extraCompilers (c: { compiler-nix-name = c; }); # cardano-cli is needed when building the docker image cabalProjectLocal = '' From 9210e2e35e255e59496b21dd199b53b5564472bb Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Fri, 27 Jun 2025 12:41:20 -0400 Subject: [PATCH 5/9] build(nix) Run tests with pkgsBuildBuild.postgresql --- flake.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index e553955ab..64308d7a0 100644 --- a/flake.nix +++ b/flake.nix @@ -236,7 +236,11 @@ # Database tests let postgresTest = { - build-tools = [ pkgs.pkgsBuildHost.postgresql_17 ]; + build-tools = [ + # We don't need the static build of postgresql to run tests, so again we choose + # pkgsBuildBuild + pkgs.pkgsBuildBuild.postgresql + ]; inherit preCheck; inherit postCheck; }; From 46ba2a8e4b162c102555289c8119513487e8903c Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Fri, 27 Jun 2025 15:38:50 -0400 Subject: [PATCH 6/9] build(nix): Use static postgresql for tests --- flake.nix | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 64308d7a0..acd196249 100644 --- a/flake.nix +++ b/flake.nix @@ -103,6 +103,22 @@ postInstall = ""; })) ]; + + postgresql = + final.lib.pipe prev.postgresql [ + (p: p.override { + gssSupport = false; + perlSupport = false; + jitSupport = false; + }) + + (p: p.overrideAttrs (old: { + postPatch = old.postPatch + '' + substituteInPlace src/interfaces/libpq/Makefile \ + --replace-fail "echo 'libpq must not be calling any function which invokes exit'; exit 1;" "echo;" + ''; + })) + ]; }) ]; }; @@ -236,11 +252,7 @@ # Database tests let postgresTest = { - build-tools = [ - # We don't need the static build of postgresql to run tests, so again we choose - # pkgsBuildBuild - pkgs.pkgsBuildBuild.postgresql - ]; + build-tools = [ pkgs.postgresql ]; inherit preCheck; inherit postCheck; }; From 7755753d8d8b018b22f73933c2dddcacd42ecda7 Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Fri, 27 Jun 2025 18:17:11 -0400 Subject: [PATCH 7/9] build(nix): Remove icu support for static postgresql --- flake.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/flake.nix b/flake.nix index acd196249..e78451c4a 100644 --- a/flake.nix +++ b/flake.nix @@ -110,9 +110,18 @@ gssSupport = false; perlSupport = false; jitSupport = false; + icuSupport = false; + pamSupport = false; + pythonSupport = false; + tclSupport = false; }) (p: p.overrideAttrs (old: { + NIX_LDFLAGS = "--push-state --as-needed -lstdc++ --pop-state"; + LC_CTYPE = "C"; + + doCheck = false; + postPatch = old.postPatch + '' substituteInPlace src/interfaces/libpq/Makefile \ --replace-fail "echo 'libpq must not be calling any function which invokes exit'; exit 1;" "echo;" From 807bff61b5136908e937d8ebd938569385e13fbf Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Wed, 2 Jul 2025 15:19:29 -0400 Subject: [PATCH 8/9] chore: nix flake iohkNix --- flake.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 6cbd83117..71ecb04d7 100644 --- a/flake.lock +++ b/flake.lock @@ -36,16 +36,16 @@ "blst": { "flake": false, "locked": { - "lastModified": 1691598027, - "narHash": "sha256-oqljy+ZXJAXEB/fJtmB8rlAr4UXM+Z2OkDa20gpILNA=", + "lastModified": 1739372843, + "narHash": "sha256-IlbNMLBjs/dvGogcdbWQIL+3qwy7EXJbIDpo4xBd4bY=", "owner": "supranational", "repo": "blst", - "rev": "3dd0f804b1819e5d03fb22ca2e6fac105932043a", + "rev": "8c7db7fe8d2ce6e76dc398ebd4d475c0ec564355", "type": "github" }, "original": { "owner": "supranational", - "ref": "v0.3.11", + "ref": "v0.3.14", "repo": "blst", "type": "github" } @@ -520,11 +520,11 @@ "sodium": "sodium" }, "locked": { - "lastModified": 1730297014, - "narHash": "sha256-n3f1iAmltKnorHWx7FrdbGIF/FmEG8SsZshS16vnpz0=", + "lastModified": 1751421193, + "narHash": "sha256-rklXDo12dfukaSqcEyiYbze3ffRtTl2/WAAQCWfkGiw=", "owner": "input-output-hk", "repo": "iohk-nix", - "rev": "d407eedd4995e88d08e83ef75844a8a9c2e29b36", + "rev": "64ca6f4c0c6db283e2ec457c775bce75173fb319", "type": "github" }, "original": { From 952b3c8b04828297457969ec40f65842cebae8d0 Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Wed, 2 Jul 2025 16:49:50 -0400 Subject: [PATCH 9/9] chore: Use ghc96 in haskellBuildTools --- flake.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flake.nix b/flake.nix index e78451c4a..87cc2dac9 100644 --- a/flake.nix +++ b/flake.nix @@ -50,6 +50,11 @@ "libpq" = [ "libpq" ]; }; }; + + haskellBuildUtils = prev.haskellBuildUtils.override { + compiler-nix-name = "ghc96"; + index-state = "2025-06-19T03:58:53Z"; + }; }) (final: prev: {