From a6dac56c82f8238d36da4b63c34a2bbff6d55882 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Fri, 6 Dec 2024 11:23:36 -0700 Subject: [PATCH 1/6] Eliminate mixed Nixpkgs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There were two Nixpkgs inputs, with one being used solely to get a particular version of Stack. This now “compromises” on the same release of Nixpkgs as used for Stack, but from the haskell.nix project to have a consistent package set. There are also a few other version bumps here (because once you change an uncached input, you might as well upgrade everything): - bump LTS to 22.43 (GHC 9.6.6 from 9.6.5) - bump HLS to 2.9 (this is now transitively included via the haskell.nix input) - bump hpack to 0.36.0 (this is actually the minimum bound for the version of Stack we use, so the previous setting was inconsistent) --- .vscode/settings.json | 2 +- flake.lock | 90 +++++++++++++++++++++++---------------- flake.nix | 33 +++++++------- nix/dependencies.nix | 22 +++------- nix/haskell-nix-flake.nix | 6 +-- stack.yaml | 2 +- stack.yaml.lock | 8 ++-- 7 files changed, 85 insertions(+), 78 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6002d51193..bdaa3344d1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "haskell.toolchain": { "cabal": "3.10.3.0", - "hls": "2.8.0.0", + "hls": "2.9.0.0", "stack": "2.15.7" } } diff --git a/flake.lock b/flake.lock index 4c07d21e1a..11be3bc9a7 100644 --- a/flake.lock +++ b/flake.lock @@ -105,11 +105,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -138,11 +138,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1719535035, - "narHash": "sha256-kCCfZytGgkRYlsiNe/dwLAnpNOvfywpjVl61hO/8l2M=", + "lastModified": 1733445020, + "narHash": "sha256-KnEbmqy2yX0316kZkgG63unxtpxpXre9z581DRQg9TM=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "66f23365685f71610460f3c2c0dfa91f96c532ac", + "rev": "3e12b545e3f597e48989811cc9d4f4f4a353921d", "type": "github" }, "original": { @@ -170,6 +170,7 @@ "hls-2.6": "hls-2.6", "hls-2.7": "hls-2.7", "hls-2.8": "hls-2.8", + "hls-2.9": "hls-2.9", "hpc-coveralls": "hpc-coveralls", "hydra": "hydra", "iserv-proxy": "iserv-proxy", @@ -184,16 +185,17 @@ "nixpkgs-2211": "nixpkgs-2211", "nixpkgs-2305": "nixpkgs-2305", "nixpkgs-2311": "nixpkgs-2311", + "nixpkgs-2405": "nixpkgs-2405", "nixpkgs-unstable": "nixpkgs-unstable", "old-ghc-nix": "old-ghc-nix", "stackage": "stackage" }, "locked": { - "lastModified": 1719535822, - "narHash": "sha256-IteIKK4+GEZI2nHqCz0zRVgQ3aqs/WXKTOt2sbHJmGk=", + "lastModified": 1733464032, + "narHash": "sha256-92Cc7s1DDX9jPpm8TvXBHUCegOUNfiit+ezOqk0kCEc=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "72bc84d0a4e8d0536505628040d96fd0a9e16c70", + "rev": "47ee8a2c90975aef07ca3188dc4918de417e1bc7", "type": "github" }, "original": { @@ -355,6 +357,23 @@ "type": "github" } }, + "hls-2.9": { + "flake": false, + "locked": { + "lastModified": 1720003792, + "narHash": "sha256-qnDx8Pk0UxtoPr7BimEsAZh9g2WuTuMB/kGqnmdryKs=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "0c1817cb2babef0765e4e72dd297c013e8e3d12b", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.9.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, "hpc-coveralls": { "flake": false, "locked": { @@ -546,11 +565,11 @@ }, "nixpkgs-2305": { "locked": { - "lastModified": 1701362232, - "narHash": "sha256-GVdzxL0lhEadqs3hfRLuj+L1OJFGiL/L7gCcelgBlsw=", + "lastModified": 1705033721, + "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d2332963662edffacfddfad59ff4f709dde80ffe", + "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", "type": "github" }, "original": { @@ -562,11 +581,11 @@ }, "nixpkgs-2311": { "locked": { - "lastModified": 1701386440, - "narHash": "sha256-xI0uQ9E7JbmEy/v8kR9ZQan6389rHug+zOtZeZFiDJk=", + "lastModified": 1719957072, + "narHash": "sha256-gvFhEf5nszouwLAkT9nWsDzocUTqLWHuL++dvNjMp9I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "293822e55ec1872f715a66d0eda9e592dc14419f", + "rev": "7144d6241f02d171d25fba3edeaf15e0f2592105", "type": "github" }, "original": { @@ -576,51 +595,51 @@ "type": "github" } }, - "nixpkgs-regression": { + "nixpkgs-2405": { "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "lastModified": 1729242558, + "narHash": "sha256-VgcLDu4igNT0eYua6OAl9pWCI0cYXhDbR+pWP44tte0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "rev": "4a3f2d3195b60d07530574988df92e049372c10e", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixpkgs-24.05-darwin", "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", "type": "github" } }, - "nixpkgs-release": { + "nixpkgs-regression": { "locked": { - "lastModified": 1719520878, - "narHash": "sha256-5BXzNOl2RVHcfS/oxaZDKOi7gVuTyWPibQG0DHd5sSc=", + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a44bedbb48c367f0476e6a3a27bf28f6330faf23", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", "type": "github" }, "original": { "owner": "NixOS", - "ref": "release-24.05", "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1694822471, - "narHash": "sha256-6fSDCj++lZVMZlyqOe9SIOL8tYSBz1bI8acwovRwoX8=", + "lastModified": 1729980323, + "narHash": "sha256-eWPRZAlhf446bKSmzw6x7RWEE4IuZgAp8NW3eXZwRAY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", + "rev": "86e78d3d2084ff87688da662cf78c2af085d8e73", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", - "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", "type": "github" } }, @@ -645,21 +664,20 @@ "inputs": { "flake-utils": "flake-utils", "haskellNix": "haskellNix", - "nixpkgs-haskellNix": [ + "nixpkgs": [ "haskellNix", - "nixpkgs-unstable" - ], - "nixpkgs-release": "nixpkgs-release" + "nixpkgs-2405" + ] } }, "stackage": { "flake": false, "locked": { - "lastModified": 1719102283, - "narHash": "sha256-pon+cXgMWPlCiBx9GlRcjsjTHbCc8fDVgOGb3Z7qhRM=", + "lastModified": 1733443946, + "narHash": "sha256-xz8bzbXm5vE3TWdvU+/7CdRSm43D9P8XftYUSVp58Ck=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "7df45e0bd9852810d8070f9c5257f8e7a4677b91", + "rev": "2e2aba31ade325ca2c6ab0f4564f568cac2110bd", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a266bd2e29..494fabf317 100644 --- a/flake.nix +++ b/flake.nix @@ -8,16 +8,14 @@ inputs = { haskellNix.url = "github:input-output-hk/haskell.nix"; - nixpkgs-haskellNix.follows = "haskellNix/nixpkgs-unstable"; - nixpkgs-release.url = "github:NixOS/nixpkgs/release-24.05"; + nixpkgs.follows = "haskellNix/nixpkgs-2405"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, haskellNix, - nixpkgs-haskellNix, - nixpkgs-release, + nixpkgs, flake-utils, }: flake-utils.lib.eachSystem [ @@ -28,32 +26,32 @@ (system: let ## It’s much easier to read from a JSON file than to have JSON import from some other file, so we extract some ## configuration from the VS Code settings to avoid duplication. - vscodeSettings = nixpkgs-release.lib.importJSON ./.vscode/settings.json; + vscodeSettings = nixpkgs.lib.importJSON ./.vscode/settings.json; versions = vscodeSettings."haskell.toolchain" ## There are some things we want to pin that the VS Code Haskell extension doesn’t let us control. // { - hpack = "0.35.2"; - ormolu = "0.7.2.0"; - }; - pkgs = import nixpkgs-haskellNix { + hpack = "0.36.0"; + ormolu = "0.7.2.0"; + }; + pkgs = import nixpkgs { inherit system; inherit (haskellNix) config; overlays = [ haskellNix.overlay - (import ./nix/dependencies.nix {inherit nixpkgs-release;}) + (import ./nix/dependencies.nix) ]; }; unison-project = import ./nix/unison-project.nix { - inherit (nixpkgs-haskellNix) lib; + inherit (nixpkgs) lib; inherit (pkgs) haskell-nix; }; haskell-nix-flake = import ./nix/haskell-nix-flake.nix { inherit pkgs unison-project versions; - inherit (nixpkgs-haskellNix) lib; + inherit (nixpkgs) lib; }; renameAttrs = fn: - nixpkgs-haskellNix.lib.mapAttrs' (name: value: { + nixpkgs.lib.mapAttrs' (name: value: { inherit value; name = fn name; }); @@ -71,11 +69,10 @@ all = pkgs.symlinkJoin { name = "all"; paths = let - all-other-packages = - builtins.attrValues (builtins.removeAttrs self.packages."${system}" [ - "all" - "docker-ucm" # this package doesn’t produce a directory - ]); + all-other-packages = builtins.attrValues (builtins.removeAttrs self.packages."${system}" [ + "all" + "docker-ucm" # this package doesn’t produce a directory + ]); devshell-inputs = builtins.concatMap (devShell: devShell.buildInputs ++ devShell.nativeBuildInputs) diff --git a/nix/dependencies.nix b/nix/dependencies.nix index 7df873660f..e1f04b9137 100644 --- a/nix/dependencies.nix +++ b/nix/dependencies.nix @@ -1,21 +1,13 @@ -{nixpkgs-release}: final: prev: let - pinned-pkgs = import nixpkgs-release {inherit (final) system;}; -in { - stack = pinned-pkgs.stack; - +final: prev: { ## See https://docs.haskellstack.org/en/stable/nix_integration/#supporting-both-nix-and-non-nix-developers for an - ## explanation of this package. - stack-wrapped = final.symlinkJoin { - name = "stack"; # will be available as the usual `stack` in terminal - paths = [final.stack]; + ## explanation of this derivation. + stack = final.symlinkJoin { + inherit (prev.stack) version; + name = "stack"; + paths = [prev.stack]; buildInputs = [final.makeWrapper]; postBuild = '' - wrapProgram $out/bin/stack \ - --add-flags "\ - --no-nix \ - --system-ghc \ - --no-install-ghc \ - " + wrapProgram $out/bin/stack --add-flags "--no-nix --system-ghc --no-install-ghc" ''; }; } diff --git a/nix/haskell-nix-flake.nix b/nix/haskell-nix-flake.nix index f63ffee53f..fe6c3d0a7c 100644 --- a/nix/haskell-nix-flake.nix +++ b/nix/haskell-nix-flake.nix @@ -35,7 +35,7 @@ pkgs.gettext # for envsubst, used by unison-src/builtin-tests/interpreter-tests.sh pkgs.hpack pkgs.pkg-config - pkgs.stack-wrapped + pkgs.stack ]; # workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/11042 shellHook = '' @@ -44,8 +44,7 @@ tools = (args.tools or {}) // { - cabal = {version = versions.cabal;}; - ormolu = {version = versions.ormolu;}; + cabal.version = versions.cabal; haskell-language-server = { version = versions.hls; modules = [ @@ -64,6 +63,7 @@ constraints: ormolu == ${versions.ormolu} ''; }; + ormolu.version = versions.ormolu; }; }; diff --git a/stack.yaml b/stack.yaml index a628e395ea..0d55bda16f 100644 --- a/stack.yaml +++ b/stack.yaml @@ -50,7 +50,7 @@ packages: - unison-syntax - yaks/easytest -resolver: lts-22.26 +resolver: lts-22.43 extra-deps: # This custom Haskeline alters ANSI rendering on Windows. diff --git a/stack.yaml.lock b/stack.yaml.lock index a2ef8c07f1..8728e141e8 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -59,7 +59,7 @@ packages: hackage: network-udp-0.0.0@sha256:408d2d4fa1a25e49e95752ee124cca641993404bb133ae10fb81daef22d876ae,1075 snapshots: - completed: - sha256: 8e7996960d864443a66eb4105338bbdd6830377b9f6f99cd5527ef73c10c01e7 - size: 719128 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/26.yaml - original: lts-22.26 + sha256: 08bd13ce621b41a8f5e51456b38d5b46d7783ce114a50ab604d6bbab0d002146 + size: 720271 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/43.yaml + original: lts-22.43 From 2cdc2ef567f1ef4bd1b0ee5ce341824553153390 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Fri, 6 Dec 2024 23:32:09 -0700 Subject: [PATCH 2/6] Update GitHub workflows to pinned Stack version These were out of sync with the intended version (specified in .vscode/settings.json). --- .github/workflows/bundle-ucm.yaml | 2 +- .github/workflows/ci.yaml | 2 +- .github/workflows/haddocks.yaml | 2 +- .github/workflows/update-transcripts.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bundle-ucm.yaml b/.github/workflows/bundle-ucm.yaml index e97da0292a..7f394e01ea 100644 --- a/.github/workflows/bundle-ucm.yaml +++ b/.github/workflows/bundle-ucm.yaml @@ -40,7 +40,7 @@ jobs: - name: install stack uses: unisonweb/actions/stack/install@main with: - stack-version: 2.15.5 + stack-version: 2.15.7 - name: build run: | diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d162852e92..ebc93c151f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -110,7 +110,7 @@ jobs: if: steps.cache-ucm-binaries.outputs.cache-hit != 'true' uses: unisonweb/actions/stack/install@main with: - stack-version: 2.15.5 + stack-version: 2.15.7 # Build deps, then build local code. Splitting it into two steps just allows us to see how much time each step # takes. diff --git a/.github/workflows/haddocks.yaml b/.github/workflows/haddocks.yaml index 2fb12dad65..d9db7cca07 100644 --- a/.github/workflows/haddocks.yaml +++ b/.github/workflows/haddocks.yaml @@ -28,7 +28,7 @@ jobs: - name: install stack uses: unisonweb/actions/stack/install@main with: - stack-version: 2.15.5 + stack-version: 2.15.7 - name: build with haddocks working-directory: unison diff --git a/.github/workflows/update-transcripts.yaml b/.github/workflows/update-transcripts.yaml index 7b298656e9..22e9e95140 100644 --- a/.github/workflows/update-transcripts.yaml +++ b/.github/workflows/update-transcripts.yaml @@ -23,7 +23,7 @@ jobs: - name: install stack uses: unisonweb/actions/stack/install@main with: - stack-version: 2.15.5 + stack-version: 2.15.7 # One of the transcripts fails if the user's git name hasn't been set. - name: set git user info From c48de917dedab012109cbb3c87c054ac88cd8ce3 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Tue, 10 Dec 2024 16:36:39 -0700 Subject: [PATCH 3/6] Adopt nix-systems pattern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Somewhat described at https://github.com/nix-systems/nix-systems This is useful for Haskell projects, because commands like ```bash nix flake show --allow-import-from-derivation ``` can often fail, complaining that it can’t find some other architecture to build on. With nix-systems, you can append `--override-input systems github:nix-systems/x86_64-linux` to the command to ensure that x86_64-linux is the only platform in play. --- flake.lock | 4 ++++ flake.nix | 14 ++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index 11be3bc9a7..6c36efb042 100644 --- a/flake.lock +++ b/flake.lock @@ -667,6 +667,10 @@ "nixpkgs": [ "haskellNix", "nixpkgs-2405" + ], + "systems": [ + "flake-utils", + "systems" ] } }, diff --git a/flake.nix b/flake.nix index 494fabf317..183277e3e6 100644 --- a/flake.nix +++ b/flake.nix @@ -7,22 +7,20 @@ }; inputs = { + flake-utils.url = "github:numtide/flake-utils"; haskellNix.url = "github:input-output-hk/haskell.nix"; nixpkgs.follows = "haskellNix/nixpkgs-2405"; - flake-utils.url = "github:numtide/flake-utils"; + systems.follows = "flake-utils/systems"; }; outputs = { - self, + flake-utils, haskellNix, nixpkgs, - flake-utils, + self, + systems, }: - flake-utils.lib.eachSystem [ - "x86_64-linux" - "x86_64-darwin" - "aarch64-darwin" - ] + flake-utils.lib.eachSystem (import systems) (system: let ## It’s much easier to read from a JSON file than to have JSON import from some other file, so we extract some ## configuration from the VS Code settings to avoid duplication. From 5737cbbc4734286c3d1e26e4e474faf67a9dab9a Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Tue, 10 Dec 2024 16:39:56 -0700 Subject: [PATCH 4/6] Enable Hoogle for local packages It is not triggering a(nother) rebuild of GHC. --- nix/haskell-nix-flake.nix | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/nix/haskell-nix-flake.nix b/nix/haskell-nix-flake.nix index fe6c3d0a7c..2410450037 100644 --- a/nix/haskell-nix-flake.nix +++ b/nix/haskell-nix-flake.nix @@ -91,18 +91,8 @@ in defaultPackage = haskell-nix-flake.packages."unison-cli-main:exe:unison"; devShells = let - mkDevShell = pkg: - shellFor { - packages = _hpkgs: [pkg]; - ## Enabling Hoogle causes us to rebuild GHC. - withHoogle = false; - }; + mkDevShell = pkg: shellFor {packages = _hpkgs: [pkg];}; in - { - local = shellFor { - packages = _hpkgs: builtins.attrValues localPackages; - withHoogle = false; - }; - } + {local = shellFor {packages = _hpkgs: builtins.attrValues localPackages;};} // pkgs.lib.mapAttrs (_name: mkDevShell) localPackages; } From 994559c83ba97106d313d9be02395b9e401d9632 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Thu, 12 Dec 2024 07:39:59 -0700 Subject: [PATCH 5/6] Remove obsolete Nix workaround This workaround required another local workaround. If you had a line like `LD_LIBRARY_PATH=` in your .envrc, it can be removed now. --- nix/haskell-nix-flake.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nix/haskell-nix-flake.nix b/nix/haskell-nix-flake.nix index 2410450037..590b1ff52f 100644 --- a/nix/haskell-nix-flake.nix +++ b/nix/haskell-nix-flake.nix @@ -37,10 +37,6 @@ pkgs.pkg-config pkgs.stack ]; - # workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/11042 - shellHook = '' - export LD_LIBRARY_PATH=${pkgs.zlib}/lib:$LD_LIBRARY_PATH - ''; tools = (args.tools or {}) // { From dc8561fe12b30807c23aa54594135303f178f47b Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Thu, 12 Dec 2024 08:18:13 -0700 Subject: [PATCH 6/6] Add `jq` to devShells, for pushing to Cachix --- nix/haskell-nix-flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/haskell-nix-flake.nix b/nix/haskell-nix-flake.nix index 590b1ff52f..5b87c853cd 100644 --- a/nix/haskell-nix-flake.nix +++ b/nix/haskell-nix-flake.nix @@ -34,6 +34,7 @@ pkgs.cachix pkgs.gettext # for envsubst, used by unison-src/builtin-tests/interpreter-tests.sh pkgs.hpack + pkgs.jq pkgs.pkg-config pkgs.stack ];