From fb0fbe3010c766087afef67e2f3c559fe93837ca Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Wed, 18 Oct 2023 22:25:31 +1300 Subject: [PATCH] Add ghc980 and ghc99 (#111) * Add ghc98020230824 and ghc9920230923 * pkgconfig is now pkg-config in nixpkgs * Point to haskell.nix with aarch64-linux * Use static nix-tools to get cabal * Use short compiler-nix-names * Fix cabal-install failure * Fix eval * Fix eval * Update haskell.nix * Fixes for ghc 9.8.1 * Update github actions * Fixes for hydra eval * Use short names and refactor a bit * Fix hlint build filter * Add missing toolsModule * Fix tools for ghc >=9.8 * Stick with long ghc nix names for now * Use short names * Leave hello.yml for now --- .github/workflows/build-and-test.yml | 2 +- .github/workflows/main.yml | 12 +- .github/workflows/wait-and-upload.yml | 6 +- README.md | 32 ++--- cross-js.nix | 14 ++- cross-windows.nix | 20 +-- docs/direnv.md | 4 +- dynamic.nix | 12 +- flake.lock | 168 +++++++++++++++++++------- flake.nix | 152 +++++++++++------------ static.nix | 10 +- tool-map.nix | 27 ++++- 12 files changed, 286 insertions(+), 173 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a9bc25b4..70d35a97 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -13,7 +13,7 @@ on: type: string compiler-nix-name: required: true - description: 'compiler name in nix format. e.g. ghc8107' + description: 'compiler name in nix format. e.g. ghc96' type: string minimal: description: 'without hls, hlint, ...' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61f386c5..65447b47 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,9 +35,11 @@ jobs: # Currently broken #- aarch64-linux compiler-nix-name: - - ghc8107 - - ghc928 - - ghc962 + - ghc810 + - ghc92 + - ghc96 + - ghc98 + - ghc99 target-platform: - "" - "-static" @@ -51,9 +53,9 @@ jobs: - "-iog" exclude: # Just cross compiling javascript with ghc 9.6.2 for now - - compiler-nix-name: ghc8107 + - compiler-nix-name: ghc810 target-platform: "-js" - - compiler-nix-name: ghc928 + - compiler-nix-name: ghc92 target-platform: "-js" # Static builds not working for darwin yet - platform: x86_64-darwin diff --git a/.github/workflows/wait-and-upload.yml b/.github/workflows/wait-and-upload.yml index 3dc5c72e..24b3c1f8 100644 --- a/.github/workflows/wait-and-upload.yml +++ b/.github/workflows/wait-and-upload.yml @@ -13,7 +13,7 @@ on: type: string compiler-nix-name: required: true - description: 'compiler name in nix format. e.g. ghc8107' + description: 'compiler name in nix format. e.g. ghc96' type: string minimal: description: 'without hls, hlint, ...' @@ -112,8 +112,8 @@ jobs: # or the `-static` one (especially since the latter currently requires `-minimal` to work). # Likely, we consider using `-iog` as the default and do not generate other images. # Then the user choices left would be between native, `-windows` or `-js` target platforms, - # and the GHC version (currently `ghc8107` and `ghc962`). - if: ${{ contains(fromJSON('["x86_64-linux", "aarch64-linux"]'), inputs.platform) && contains(fromJson('["","-windows","-js"]'), inputs.target-platform) && contains(fromJson('["ghc8107","ghc962"]'), inputs.compiler-nix-name) && !inputs.minimal && inputs.iog }} + # and the GHC version (currently `ghc810` and `ghc96`). + if: ${{ contains(fromJSON('["x86_64-linux", "aarch64-linux"]'), inputs.platform) && contains(fromJson('["","-windows","-js"]'), inputs.target-platform) && contains(fromJson('["ghc810","ghc96"]'), inputs.compiler-nix-name) && !inputs.minimal && inputs.iog }} steps: - name: Checkout repository uses: actions/checkout@v3 diff --git a/README.md b/README.md index a6c9b32a..9a11113b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Once you have `nix` installed you can check that everything is working correctly Once you have `nix`, (linux, macOS, windows WSL) you can use ```bash -nix develop github:input-output-hk/devx#ghc8107 --no-write-lock-file --refresh +nix develop github:input-output-hk/devx#ghc96 --no-write-lock-file --refresh ``` to obtain a haskell evelopment shell for GHC 8.10.7 including `cabal-install`, @@ -23,11 +23,11 @@ and want to switch between Intel (x86_64) and Apple Silicon (aarch64), you can d this by simply passing the corresponding `--system` argument: ```bash -nix develop github:input-output-hk/devx#ghc8107 --no-write-lock-file --refresh --system x86_64-darwin +nix develop github:input-output-hk/devx#ghc810 --no-write-lock-file --refresh --system x86_64-darwin ``` or ```bash -nix develop github:input-output-hk/devx#ghc8107 --no-write-lock-file --refresh --system aarch64-darwin +nix develop github:input-output-hk/devx#ghc810 --no-write-lock-file --refresh --system aarch64-darwin ``` ## `direnv` integration @@ -39,7 +39,7 @@ if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" fi # https://github.com/input-output-hk/devx Slightly opinionated shared GitHub Action for Cardano-Haskell projects -use flake "github:input-output-hk/devx#ghc8107-iog" +use flake "github:input-output-hk/devx#ghc810-iog" ``` Refer to [`direnv` and `devx`](./docs/direnv.md) guide for more information. @@ -49,7 +49,7 @@ Refer to [`direnv` and `devx`](./docs/direnv.md) guide for more information. To make this developer shell available in VSCode DevContainer or GitHub CodeSpace, simply add a file named `.devcontainer/devcontainer.json` with the following content: ```json { - "image":"ghcr.io/input-output-hk/devx-devcontainer:ghc8107-iog", + "image":"ghcr.io/input-output-hk/devx-devcontainer:ghc810-iog", "customizations":{ "vscode":{ "extensions":[ @@ -66,27 +66,27 @@ This configuration will work immediately in GitHub CodeSpace! For local VSCode D It's also advise to enable GitHub CodeSpace prebuilds in your repository settings, follow the instructions provided in the [GitHub documentation](https://docs.github.com/en/codespaces/prebuilding-your-codespaces/configuring-prebuilds). This will significantly enhance your development experience by reducing the setup time when opening a new CodeSpace. -List of images available: `ghc8107-iog`, `ghc962-iog`, `ghc8107-js-iog`, `ghc962-js-iog`, `ghc8107-windows-iog`, `ghc962-windows-iog` +List of images available: `ghc810-iog`, `ghc96-iog`, `ghc810-js-iog`, `ghc96-js-iog`, `ghc810-windows-iog`, `ghc96-windows-iog` ## Compilers and Flavours There are multiple compilers available, and usually the latest for each series from 8.10 to 9.6 (a slight delay between the official release announcement and the compiler showing up in the devx shell is expected due to integration work -necessary). The current available ones are: `ghc8107`, `ghc902`, `ghc928`,`ghc945`, and -`ghc962` (these are the same ones as in [haskell.nix](https://github.com/input-output-hk/haskell.nix) and may contain patches for defects in the official releases). +necessary). The current available ones are: `ghc810`, `ghc90`, `ghc92`,`ghc94`, and +`ghc96` (these are the same ones as in [haskell.nix](https://github.com/input-output-hk/haskell.nix) and may contain patches for defects in the official releases). ### Flavours -There are various flavours available as suffixes to the compiler names (e.g. `#ghc8107-minimal-iog`). +There are various flavours available as suffixes to the compiler names (e.g. `#ghc810-minimal-iog`). | Flavour | Description | Example | Included | | - | - | - | - | -| empty | General Haskell Dev | `#ghc8107` | `ghc`, `cabal-install`, `hls`, `hlint` | -| `-iog` | IOG Haskell Dev | `#ghc8107` | adds `sodium-vrf`, `blst`, `secp256k1`, `R`, `postgresql` | -| `-minimal` | Only GHC, and Cabal | `#ghc8107-minimal` | drops `hls`, `hlint` | -| `-static` | Building static binaries | `#ghc8107-static` | static haskell cross compiler | -| `-js` | JavaScript Cross Compiler | `#ghc8107-js` | javascript haskell cross compiler | -| `-windows` | Windows Cross Compiler | `#ghc8107-windows` | windows haskell cross compiler | +| empty | General Haskell Dev | `#ghc810` | `ghc`, `cabal-install`, `hls`, `hlint` | +| `-iog` | IOG Haskell Dev | `#ghc810` | adds `sodium-vrf`, `blst`, `secp256k1`, `R`, `postgresql` | +| `-minimal` | Only GHC, and Cabal | `#ghc810-minimal` | drops `hls`, `hlint` | +| `-static` | Building static binaries | `#ghc810-static` | static haskell cross compiler | +| `-js` | JavaScript Cross Compiler | `#ghc810-js` | javascript haskell cross compiler | +| `-windows` | Windows Cross Compiler | `#ghc810-windows` | windows haskell cross compiler | these can then be comined following this schema: ``` @@ -94,7 +94,7 @@ these can then be comined following this schema: ``` For example ```bash -nix develop github:input-output-hk/devx#ghc8107-windows-minimal-iog --no-write-lock-file --refresh +nix develop github:input-output-hk/devx#ghc810-windows-minimal-iog --no-write-lock-file --refresh ``` would provide a development shell with a windows cross compiler as well as cabal, and the IOG specific libraries, but no Haskell Language Server (hls), and no HLint. diff --git a/cross-js.nix b/cross-js.nix index b086aa22..318c9b8a 100644 --- a/cross-js.nix +++ b/cross-js.nix @@ -1,7 +1,7 @@ { self, pkgs, compiler, compiler-nix-name, toolsModule, withHLS ? true, withHlint ? true, withIOG ? true }: let tool-version-map = import ./tool-map.nix; tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule]; - cabal-install = tool "cabal"; + cabal-install = pkgs.haskell-nix.nix-tools-unchecked.exes.cabal; # add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler. compiler-not-in = compiler-list: name: (if __elem compiler-nix-name compiler-list then __trace "No ${name}. Not yet compatible with ${compiler-nix-name}" false else true); @@ -73,14 +73,18 @@ pkgs.mkShell ({ nativeBuildInputs = [ wrapped-hsc2hs wrapped-cabal compiler ] ++ (with pkgs; [ nodejs # helpful to evaluate output on the commandline. - haskell-nix.cabal-install.${compiler-nix-name} - pkgconfig + cabal-install + (pkgs.pkg-config or pkgconfig) (tool "happy") (tool "alex") stdenv.cc.cc.lib ]) ++ (with pkgs.buildPackages; [ ]) - ++ pkgs.lib.optional (withHLS) (tool "haskell-language-server") - ++ pkgs.lib.optional (withHlint && (compiler-not-in ["ghc961" "ghc962"] "HLint")) (tool "hlint") + ++ pkgs.lib.optional (withHLS && (compiler-not-in ( + pkgs.lib.optional (builtins.compareVersions compiler.version "9.9" >= 0) compiler-nix-name + ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server") + ++ pkgs.lib.optional (withHlint && (compiler-not-in ( + pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name + ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint") ++ pkgs.lib.optional withIOG (with pkgs; [ cddl cbor-diag ] ++ map pkgs.lib.getDev (with pkgs; [ diff --git a/cross-windows.nix b/cross-windows.nix index d54af521..a6ed2e0f 100644 --- a/cross-windows.nix +++ b/cross-windows.nix @@ -1,7 +1,7 @@ -{ self, pkgs, compiler, compiler-nix-name, withHLS ? true, withHlint ? true, withIOG ? true }: +{ self, pkgs, compiler, compiler-nix-name, toolsModule, withHLS ? true, withHlint ? true, withIOG ? true }: let tool-version-map = import ./tool-map.nix; - tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name (tool-version-map compiler-nix-name tool-name); - cabal-install = tool "cabal"; + tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule]; + cabal-install = pkgs.pkgsBuildBuild.haskell-nix.nix-tools-unchecked.exes.cabal; # add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler. compiler-not-in = compiler-list: name: (if __elem compiler-nix-name compiler-list then __trace "No ${name}. Not yet compatible with ${compiler-nix-name}" false else true); @@ -157,17 +157,21 @@ pkgs.pkgsBuildBuild.mkShell ({ buildPackages.bintools.bintools stdenv.cc pkgsBuildBuild.haskell-nix.cabal-install.${compiler-nix-name} - pkgsBuildBuild.pkgconfig - (pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name "happy" "1.20.1.1") - (pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name "alex" "3.2.7.3") + (pkgsBuildBuild.pkg-config or pkgsBuildBuild.pkgconfig) + (tool "happy") + (tool "alex") stdenv.cc.cc.lib ]) ++ map pkgs.lib.getDev (with pkgs; [ zlib pcre openssl windows.mcfgthreads windows.mingw_w64_pthreads ]) - ++ pkgs.lib.optional (withHLS && (compiler-not-in (pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server") - ++ pkgs.lib.optional (withHlint && (compiler-not-in (["ghc961" "ghc962"] ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint") + ++ pkgs.lib.optional (withHLS && (compiler-not-in ( + pkgs.lib.optional (builtins.compareVersions compiler.version "9.9" >= 0) compiler-nix-name + ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server") + ++ pkgs.lib.optional (withHlint && (compiler-not-in ( + pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name + ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint") ++ pkgs.lib.optional withIOG (with pkgs.pkgsBuildBuild; [ cddl cbor-diag ] ++ map pkgs.lib.getDev (with pkgs; [ diff --git a/docs/direnv.md b/docs/direnv.md index 89669428..b09cd217 100644 --- a/docs/direnv.md +++ b/docs/direnv.md @@ -78,10 +78,10 @@ if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" fi # https://github.com/input-output-hk/devx Slightly opinionated shared GitHub Action for Cardano-Haskell projects -use flake "github:input-output-hk/devx#ghc8107-iog" +use flake "github:input-output-hk/devx#ghc96-iog" ``` -This will tell `direnv` to instantiate a shell with the same environment as `nix develop github:input-output-hk/devx#ghc8107-iog`, when changing into the folder where the `.envrc` resides. +This will tell `direnv` to instantiate a shell with the same environment as `nix develop github:input-output-hk/devx#ghc96-iog`, when changing into the folder where the `.envrc` resides. You can also pin the flake to a specific version. This is a good practice to ensure reproducibility across different machines and systems. Refer to the Nix Flakes documentation on how to do this. Then, allow Direnv to take effect: diff --git a/dynamic.nix b/dynamic.nix index 6c1ceaf0..c3ea356d 100644 --- a/dynamic.nix +++ b/dynamic.nix @@ -2,7 +2,7 @@ { self, pkgs, compiler, compiler-nix-name, toolsModule, withHLS ? true, withHlint ? true, withIOG ? true }: let tool-version-map = import ./tool-map.nix; tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule]; - cabal-install = tool "cabal"; + cabal-install = pkgs.haskell-nix.nix-tools-unchecked.exes.cabal; # add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler. compiler-not-in = compiler-list: name: (if __elem compiler-nix-name compiler-list then __trace "No ${name}. Not yet compatible with ${compiler-nix-name}" false else true); @@ -72,7 +72,7 @@ pkgs.mkShell { fixup-nix-deps compiler ] ++ (with pkgs; [ - pkgconfig + (pkgs.pkg-config or pkgconfig) # for libstdc++; ghc not being able to find this properly is bad, # it _should_ probably call out to a g++ or clang++ but doesn't. stdenv.cc.cc.lib @@ -85,8 +85,12 @@ pkgs.mkShell { ] ++ pkgs.lib.optional pkgs.stdenv.hostPlatform.isLinux systemd ) - ++ pkgs.lib.optional (withHLS && (compiler-not-in (pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server") - ++ pkgs.lib.optional (withHlint && (compiler-not-in (["ghc961" "ghc962"] ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint") + ++ pkgs.lib.optional (withHLS && (compiler-not-in ( + pkgs.lib.optional (builtins.compareVersions compiler.version "9.9" >= 0) compiler-nix-name + ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server") + ++ pkgs.lib.optional (withHlint && (compiler-not-in ( + pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name + ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint") ++ pkgs.lib.optional withIOG (with pkgs; [ cddl diff --git a/flake.lock b/flake.lock index 6b77dc8f..1eaf865a 100644 --- a/flake.lock +++ b/flake.lock @@ -135,22 +135,6 @@ "type": "github" } }, - "flake-utils_2": { - "locked": { - "lastModified": 1679360468, - "narHash": "sha256-LGnza3cfXF10Biw3ZTg0u9o9t7s680Ww200t5KkHTh8=", - "owner": "hamishmack", - "repo": "flake-utils", - "rev": "e1ea268ff47ad475443dbabcd54744b4e5b9d4f5", - "type": "github" - }, - "original": { - "owner": "hamishmack", - "ref": "hkm/nested-hydraJobs", - "repo": "flake-utils", - "type": "github" - } - }, "ghc-8.6.5-iohk": { "flake": false, "locked": { @@ -168,14 +152,51 @@ "type": "github" } }, + "ghc98X": { + "flake": false, + "locked": { + "lastModified": 1696643148, + "narHash": "sha256-E02DfgISH7EvvNAu0BHiPvl1E5FGMDi0pWdNZtIBC9I=", + "ref": "ghc-9.8", + "rev": "443e870d977b1ab6fc05f47a9a17bc49296adbd6", + "revCount": 61642, + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" + }, + "original": { + "ref": "ghc-9.8", + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" + } + }, + "ghc99": { + "flake": false, + "locked": { + "lastModified": 1697054644, + "narHash": "sha256-kKarOuXUaAH3QWv7ASx+gGFMHaHKe0pK5Zu37ky2AL4=", + "ref": "refs/heads/master", + "rev": "f383a242c76f90bcca8a4d7ee001dcb49c172a9a", + "revCount": 62040, + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" + }, + "original": { + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" + } + }, "hackage": { "flake": false, "locked": { - "lastModified": 1686011121, - "narHash": "sha256-X3Y62tv813/6JJ9VjT5y8s5+f2QBP6eTkY81/N9KxNg=", + "lastModified": 1697329475, + "narHash": "sha256-cyp4bvVyDWa27pv6Fc9mIXM7+Kn9dNv2tlGx13A0XsI=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "2d80060cbd948d851b473f4ff596d58419aebc4c", + "rev": "c1d90e14c6ea1048275a97cd56546c3db116ad47", "type": "github" }, "original": { @@ -192,11 +213,15 @@ "cabal-36": "cabal-36", "cardano-shell": "cardano-shell", "flake-compat": "flake-compat", - "flake-utils": "flake-utils_2", "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", + "ghc98X": "ghc98X", + "ghc99": "ghc99", "hackage": "hackage", "hls-1.10": "hls-1.10", "hls-2.0": "hls-2.0", + "hls-2.2": "hls-2.2", + "hls-2.3": "hls-2.3", + "hls-2.4": "hls-2.4", "hpc-coveralls": "hpc-coveralls", "hydra": "hydra", "iserv-proxy": "iserv-proxy", @@ -215,11 +240,11 @@ "stackage": "stackage" }, "locked": { - "lastModified": 1686041216, - "narHash": "sha256-RP0i9YtZbUkPtPVRz3GuBt9bwfoWCKcJ8888vocTiyg=", + "lastModified": 1697415012, + "narHash": "sha256-QYeYRA9KbMuy+N4fYWTSHT571VUGmyN0TzOBYDh0ARo=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "bc3f8b660a3b40f52139f59213652e083e6d2418", + "rev": "4589f9d34ee36f3f622177fcd665c2e7084308d1", "type": "github" }, "original": { @@ -248,16 +273,67 @@ "hls-2.0": { "flake": false, "locked": { - "lastModified": 1684398654, - "narHash": "sha256-RW44up2BIyBBYN6tZur5f9kDDR3kr0Rd+TgPbLTfwB4=", + "lastModified": 1687698105, + "narHash": "sha256-OHXlgRzs/kuJH8q7Sxh507H+0Rb8b7VOiPAjcY9sM1k=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "783905f211ac63edf982dd1889c671653327e441", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.0.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.2": { + "flake": false, + "locked": { + "lastModified": 1693064058, + "narHash": "sha256-8DGIyz5GjuCFmohY6Fa79hHA/p1iIqubfJUTGQElbNk=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "b30f4b6cf5822f3112c35d14a0cba51f3fe23b85", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.2.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.3": { + "flake": false, + "locked": { + "lastModified": 1695910642, + "narHash": "sha256-tR58doOs3DncFehHwCLczJgntyG/zlsSd7DgDgMPOkI=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "458ccdb55c9ea22cd5d13ec3051aaefb295321be", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.3.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.4": { + "flake": false, + "locked": { + "lastModified": 1696939266, + "narHash": "sha256-VOMf5+kyOeOmfXTHlv4LNFJuDGa7G3pDnOxtzYR40IU=", "owner": "haskell", "repo": "haskell-language-server", - "rev": "20c6d1e731cd9c0beef7338e2fc7a8126ba9b6fb", + "rev": "362fdd1293efb4b82410b676ab1273479f6d17ee", "type": "github" }, "original": { "owner": "haskell", - "ref": "2.0.0.0", + "ref": "2.4.0.0", "repo": "haskell-language-server", "type": "github" } @@ -325,11 +401,11 @@ "iserv-proxy": { "flake": false, "locked": { - "lastModified": 1670983692, - "narHash": "sha256-avLo34JnI9HNyOuauK5R69usJm+GfW3MlyGlYxZhTgY=", + "lastModified": 1691634696, + "narHash": "sha256-MZH2NznKC/gbgBu8NgIibtSUZeJ00HTLJ0PlWKCBHb0=", "ref": "hkm/remote-iserv", - "rev": "50d0abb3317ac439a4e7495b185a64af9b7b9300", - "revCount": 10, + "rev": "43a979272d9addc29fbffc2e8542c5d96e993d73", + "revCount": 14, "type": "git", "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" }, @@ -442,11 +518,11 @@ }, "nixpkgs-2205": { "locked": { - "lastModified": 1682600000, - "narHash": "sha256-ha4BehR1dh8EnXSoE1m/wyyYVvHI9txjW4w5/oxsW5Y=", + "lastModified": 1685573264, + "narHash": "sha256-Zffu01pONhs/pqH07cjlF10NnMDLok8ix5Uk4rhOnZQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "50fc86b75d2744e1ab3837ef74b53f103a9b55a0", + "rev": "380be19fbd2d9079f677978361792cb25e8a3635", "type": "github" }, "original": { @@ -458,11 +534,11 @@ }, "nixpkgs-2211": { "locked": { - "lastModified": 1685314633, - "narHash": "sha256-8LXBPqTQXl5ofkjpJ18JcbmLJ/lWDoMxtUwiDYv0wro=", + "lastModified": 1688392541, + "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c8a17ce7abc03c50cd072e9e6c9b389c5f61836b", + "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", "type": "github" }, "original": { @@ -474,11 +550,11 @@ }, "nixpkgs-2305": { "locked": { - "lastModified": 1685338297, - "narHash": "sha256-+Aq4O0Jn1W1q927ZHc3Zn6RO7bwQGmb6O8xYoGy0KrM=", + "lastModified": 1695416179, + "narHash": "sha256-610o1+pwbSu+QuF3GE0NU5xQdTHM3t9wyYhB9l94Cd8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6287b47dbfabbb8bfbb9b1b53d198ad58a774de4", + "rev": "715d72e967ec1dd5ecc71290ee072bcaf5181ed6", "type": "github" }, "original": { @@ -506,11 +582,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1685347552, - "narHash": "sha256-9woSppRyUFo26yUffORTzttJ+apOt8MmCv6RxpPNTU4=", + "lastModified": 1695318763, + "narHash": "sha256-FHVPDRP2AfvsxAdc+AsgFJevMz5VBmnZglFUMlxBkcY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f2f1ec390714d303cf84ba086e34e45b450dd8c4", + "rev": "e12483116b3b51a185a33a272bf351e357ba9a99", "type": "github" }, "original": { @@ -601,11 +677,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1685923834, - "narHash": "sha256-5oTnK+dXt1elpbLwVUYiyKroFcCMvRzEPz/PBKRtIIA=", + "lastModified": 1697328588, + "narHash": "sha256-IrRJzGiGRd4lq9U0dANDpoiSeHd4pnTVA76DbMC7fwA=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "fe1d92917a72ec690dbe61a81318931052be6179", + "rev": "b6a72b7b02a9aa017169c639774fda1573fd09c3", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 3a87b8bc..ce4fc590 100644 --- a/flake.nix +++ b/flake.nix @@ -59,7 +59,7 @@ # # Usage: # - # nix develop github:input-output-hk/devx#ghc924 --no-write-lock-file -c cabal build + # nix develop github:input-output-hk/devx#ghc96 --no-write-lock-file -c cabal build # static-pkgs = if pkgs.stdenv.hostPlatform.isLinux then if pkgs.stdenv.hostPlatform.isAarch64 @@ -69,92 +69,94 @@ js-pkgs = pkgs.pkgsCross.ghcjs; windows-pkgs = pkgs.pkgsCross.mingwW64; devShellsWithToolsModule = toolsModule: - let compilers = pkgs: builtins.removeAttrs pkgs.haskell-nix.compiler - # Exclude old versions of GHC to speed up `nix flake check` - [ "ghc844" - "ghc861" "ghc862" "ghc863" "ghc864" "ghc865" - "ghc881" "ghc882" "ghc883" "ghc884" - "ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc810420210212" - "ghc901" - "ghc921" "ghc922" "ghc923" "ghc924" "ghc925" "ghc926" "ghc927" - "ghc941" "ghc942" "ghc943" "ghc944" - "ghc96020230302" - "ghc961" - ]; + # Map the compiler-nix-name to a final compiler-nix-name the way haskell.nix + # projects do (that way we can use short names) + let compilers = pkgs: pkgs.lib.genAttrs [ + "ghc810" + "ghc90" + "ghc92" + "ghc94" + "ghc96" + "ghc98" + "ghc99"] (short-name: rec { + inherit pkgs self toolsModule; + compiler-nix-name = pkgs.haskell-nix.resolve-compiler-name short-name; + compiler = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}; + }); js-compilers = pkgs: builtins.removeAttrs (compilers pkgs) [ - "ghc902" - "ghc928" - "ghc945" + "ghc90" + "ghc92" + "ghc94" ]; windows-compilers = pkgs: pkgs.lib.optionalAttrs (__elem system ["x86_64-linux"]) (builtins.removeAttrs (compilers pkgs) [ ]); - in (builtins.mapAttrs (compiler-nix-name: compiler: - import ./dynamic.nix { inherit pkgs self compiler compiler-nix-name toolsModule; withIOG = false; } + in (builtins.mapAttrs (short-name: args: + import ./dynamic.nix (args // { withIOG = false; }) ) (compilers pkgs) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-minimal" ( - import ./dynamic.nix { inherit pkgs self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; withIOG = false; } + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-minimal" ( + import ./dynamic.nix (args // { withHLS = false; withHlint = false; withIOG = false; }) )) (compilers pkgs) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-static" ( - import ./static.nix { pkgs = static-pkgs; inherit self compiler compiler-nix-name toolsModule; withIOG = false; } - )) (compilers static-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-static-minimal" ( - import ./static.nix { pkgs = static-pkgs; inherit self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; withIOG = false; } - )) (compilers static-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-js" ( - import ./cross-js.nix { pkgs = js-pkgs.buildPackages; inherit self compiler compiler-nix-name toolsModule; } - )) (js-compilers js-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-js-minimal" ( - import ./cross-js.nix { pkgs = js-pkgs.buildPackages; inherit self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; } - )) (js-compilers js-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-windows" ( - import ./cross-windows.nix { pkgs = windows-pkgs; inherit self compiler compiler-nix-name; } - )) (windows-compilers windows-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-windows-minimal" ( - import ./cross-windows.nix { pkgs = windows-pkgs; inherit self compiler compiler-nix-name; withHLS = false; withHlint = false; } - )) (windows-compilers windows-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-iog" ( - import ./dynamic.nix { inherit pkgs self compiler compiler-nix-name toolsModule; withIOG = true; } + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-static" ( + import ./static.nix (args // { withIOG = false; }) + )) (compilers static-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-static-minimal" ( + import ./static.nix (args // { withHLS = false; withHlint = false; withIOG = false; }) + )) (compilers static-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-js" ( + import ./cross-js.nix (args // { pkgs = js-pkgs.pkgsBuildBuild; }) + )) (js-compilers js-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-js-minimal" ( + import ./cross-js.nix (args // { pkgs = js-pkgs.buildPackages; withHLS = false; withHlint = false; }) + )) (js-compilers js-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-windows" ( + import ./cross-windows.nix args + )) (windows-compilers windows-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-windows-minimal" ( + import ./cross-windows.nix (args // { withHLS = false; withHlint = false; }) + )) (windows-compilers windows-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-iog" ( + import ./dynamic.nix (args // { withIOG = true; }) )) (compilers pkgs) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-minimal-iog" ( - import ./dynamic.nix { inherit pkgs self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; withIOG = true; } + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-minimal-iog" ( + import ./dynamic.nix (args // { withHLS = false; withHlint = false; withIOG = true; }) )) (compilers pkgs) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-static-iog" ( - import ./static.nix { pkgs = static-pkgs; inherit self compiler compiler-nix-name toolsModule; withIOG = true; } - )) (compilers static-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-static-minimal-iog" ( - import ./static.nix { pkgs = static-pkgs; inherit self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; withIOG = true; } - )) (compilers static-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-js-iog" ( - import ./cross-js.nix { pkgs = js-pkgs.buildPackages; inherit self compiler compiler-nix-name toolsModule; withIOG = true; } - )) (js-compilers js-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-js-minimal-iog" ( - import ./cross-js.nix { pkgs = js-pkgs.buildPackages; inherit self compiler compiler-nix-name toolsModule; withHLS = false; withHlint = false; withIOG = true; } - )) (js-compilers js-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-windows-iog" ( - import ./cross-windows.nix { pkgs = windows-pkgs; inherit self compiler compiler-nix-name; withIOG = true; } - )) (windows-compilers windows-pkgs.buildPackages) - // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: - pkgs.lib.nameValuePair "${compiler-nix-name}-windows-minimal-iog" ( - import ./cross-windows.nix { pkgs = windows-pkgs; inherit self compiler compiler-nix-name; withHLS = false; withHlint = false; withIOG = true; } - )) (windows-compilers windows-pkgs.buildPackages) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-static-iog" ( + import ./static.nix (args // { withIOG = true; }) + )) (compilers static-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-static-minimal-iog" ( + import ./static.nix (args // { withHLS = false; withHlint = false; withIOG = true; }) + )) (compilers static-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-js-iog" ( + import ./cross-js.nix (args // { pkgs = js-pkgs.buildPackages; withIOG = true; }) + )) (js-compilers js-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-js-minimal-iog" ( + import ./cross-js.nix (args // { pkgs = js-pkgs.buildPackages; withHLS = false; withHlint = false; withIOG = true; }) + )) (js-compilers js-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-windows-iog" ( + import ./cross-windows.nix (args // { withIOG = true; }) + )) (windows-compilers windows-pkgs) + // pkgs.lib.mapAttrs' (short-name: args: + pkgs.lib.nameValuePair "${short-name}-windows-minimal-iog" ( + import ./cross-windows.nix (args // { withHLS = false; withHlint = false; withIOG = true; }) + )) (windows-compilers windows-pkgs) ); devShells = devShellsWithToolsModule {}; # Eval must be done on linux when we use hydra to build environment diff --git a/static.nix b/static.nix index f62e68bf..46467b36 100644 --- a/static.nix +++ b/static.nix @@ -1,7 +1,7 @@ { self, pkgs, compiler, compiler-nix-name, toolsModule, withHLS ? true, withHlint ? true, withIOG ? true }: let tool-version-map = import ./tool-map.nix; tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule]; - cabal-install = tool "cabal"; + cabal-install = pkgs.pkgsBuildBuild.haskell-nix.nix-tools-unchecked.exes.cabal; # add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler. compiler-not-in = compiler-list: name: (if __elem compiler-nix-name compiler-list then __trace "No ${name}. Not yet compatible with ${compiler-nix-name}" false else true); @@ -131,11 +131,13 @@ pkgs.mkShell (rec { # products to be static. (compiler.override { enableShared = true; }) ] ++ (with pkgs; [ - pkgconfig + (pkgs.pkg-config or pkgconfig) stdenv.cc.cc.lib ]) ++ (with pkgs.buildPackages; [ ]) - ++ pkgs.lib.optional (withHLS && (compiler-not-in (pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server") - ++ pkgs.lib.optional (withHlint && (compiler-not-in (["ghc961" "ghc962"] ++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint") + ++ pkgs.lib.optional (withHLS && (compiler-not-in ( + pkgs.lib.optional (builtins.compareVersions compiler.version "9.9" >= 0) compiler-nix-name) "Haskell Language Server")) (tool "haskell-language-server") + ++ pkgs.lib.optional (withHlint && (compiler-not-in ( + pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name) "HLint")) (tool "hlint") ++ pkgs.lib.optional withIOG (with pkgs; [ cddl cbor-diag ]) ; }) diff --git a/tool-map.nix b/tool-map.nix index ec005bdb..654233c1 100644 --- a/tool-map.nix +++ b/tool-map.nix @@ -1,20 +1,39 @@ # see https://haskell-language-server.readthedocs.io/en/latest/support/ghc-version-support.html # so we assume "latest" for all hls. # for hlint however, we need hlint-3.3 for ghc-8.10.7. -let fixed-versions = { "hlint" = { "ghc8107" = { version = "3.3"; }; }; }; in +let + fixed-versions = { "hlint" = { "ghc8107" = { version = "3.4.1"; }; "ghc902" = { version = "3.5"; }; }; }; + cabalProjectLocal = '' + repository head.hackage.ghc.haskell.org + url: https://ghc.gitlab.haskell.org/head.hackage/ + secure: True + key-threshold: 3 + root-keys: + f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 + 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 + 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d + --sha256: sha256-aVI93DtHziicNn2mGli0YE+bC5BeT7mOQQETp2Thi68= + + if impl(ghc < 9.7) + active-repositories: hackage.haskell.org + else + active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org + ''; +in compiler-nix-name: tool: { # for HLS, we rely on the cabal.project configuration from the upstream project to have the correct configuration. # Building HLS from hackage requires setting all those constraints as well, and just isn't practical to do for each # HLS release. Therefore we rely on the HLS upstream repository to provide the proper configuration information. haskell-language-server = {pkgs, ...}: rec { # Use the github source of HLS that is tested with haskell.nix CI - src = pkgs.haskell-nix.sources."hls-2.0"; + src = { "ghc8107" = pkgs.haskell-nix.sources."hls-2.2"; }.${compiler-nix-name} or pkgs.haskell-nix.sources."hls-2.4"; # `tool` normally ignores the `cabal.project` (if there is one in the hackage source). # We need to use the github one (since it has settings to make hls build). cabalProject = __readFile (src + "/cabal.project"); + inherit cabalProjectLocal; # sha256 for a `source-repository-package` in the `cabal.project` file. sha256map."https://github.com/pepeiborra/ekg-json"."7a0af7a8fd38045fd15fb13445bdcc7085325460" = "sha256-fVwKxGgM0S4Kv/4egVAAiAjV7QB5PBqMVMCfsv7otIQ="; }; - happy = { version = "1.20.1.1"; }; - alex = { version = "3.2.7.3"; }; + happy = { version = "1.20.1.1"; inherit cabalProjectLocal; }; + alex = { version = "3.2.7.3"; inherit cabalProjectLocal; }; }.${tool} or fixed-versions.${tool}.${compiler-nix-name} or {}