From 7f1bb8b5b159d15059466eadc4d1be3d982a1b18 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Fri, 6 Dec 2024 11:23:36 -0700 Subject: [PATCH] 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