From 567a0f12a1896c154369c4a8c02aabe08f656511 Mon Sep 17 00:00:00 2001 From: "Sam A. Horvath-Hunt" Date: Fri, 4 Aug 2023 21:30:39 +0100 Subject: [PATCH 1/5] install-nix-action: v18 -> v22 --- .github/workflows/check.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index deeed35..ac1b3cc 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -12,14 +12,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v18 + - uses: cachix/install-nix-action@v22 - run: nix flake check build: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v18 + - uses: cachix/install-nix-action@v22 - run: nix develop -c cabal update - run: nix develop -c cabal freeze - uses: actions/cache@v3 @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v18 + - uses: cachix/install-nix-action@v22 - run: nix develop -c cabal update - run: nix develop -c cabal freeze - uses: actions/cache@v3 @@ -45,14 +45,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v18 + - uses: cachix/install-nix-action@v22 - run: nix develop -c hlint lib cli test fmt: name: Formatting runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v18 + - uses: cachix/install-nix-action@v22 # stylish-haskell doesn't have a check/dry run option, so we'll run it # against files in place and test if there are any diffs with Git. - run: | @@ -66,7 +66,7 @@ jobs: working-directory: .golden/ts/ steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v18 + - uses: cachix/install-nix-action@v22 - uses: actions/cache@v3 with: path: ~/.cache/yarn/v6 From c972a74aa3f0119f0c6c762541b63672148d6ac5 Mon Sep 17 00:00:00 2001 From: "Sam A. Horvath-Hunt" Date: Fri, 4 Aug 2023 21:57:47 +0100 Subject: [PATCH 2/5] Remove git from Nix shell This is assumed to exist. Like a network connection. --- flake.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/flake.nix b/flake.nix index d681a37..80ac374 100644 --- a/flake.nix +++ b/flake.nix @@ -58,8 +58,6 @@ in { devShells.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ - git - cabal-install hlint haskPkgs.hspec-golden From 0525bc39cbf66b2f2c66e20fe6fde96992eff9e1 Mon Sep 17 00:00:00 2001 From: "Sam A. Horvath-Hunt" Date: Wed, 13 Sep 2023 16:26:41 +0100 Subject: [PATCH 3/5] Source HLS without overriding I get the feeling this is considered best practice. --- flake.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 80ac374..debdfd4 100644 --- a/flake.nix +++ b/flake.nix @@ -45,16 +45,15 @@ flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; - ghcVer = "924"; + ghcVer = "ghc924"; + haskPkgs = pkgs.haskell.packages."${ghcVer}"; hask = if system == flake-utils.lib.system.aarch64-darwin then [ ] - else with pkgs; [ - haskell.compiler."ghc${ghcVer}" - (haskell-language-server.override { supportedGhcVersions = [ ghcVer ];}) + else [ + pkgs.haskell.compiler."${ghcVer}" + haskPkgs.haskell-language-server ]; - - haskPkgs = pkgs.haskell.packages."ghc${ghcVer}"; in { devShells.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ From a9ee8f2aacd9ad647657a88afdd95fe77f22ff56 Mon Sep 17 00:00:00 2001 From: "Sam A. Horvath-Hunt" Date: Wed, 13 Sep 2023 16:31:06 +0100 Subject: [PATCH 4/5] Update inputs / GHC: 9.2.4 -> 9.4.6 --- flake.lock | 32 +++++++++++++++++++++++++------- flake.nix | 8 ++------ intlc.cabal | 12 ++++++------ 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/flake.lock b/flake.lock index d5f86d8..51ee8f8 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,15 @@ { "nodes": { "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "type": "github" }, "original": { @@ -17,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1665613119, - "narHash": "sha256-VTutbv5YKeBGWou6ladtgfx11h6et+Wlkdyh4jPJ3p0=", - "owner": "NixOS", + "lastModified": 1694593561, + "narHash": "sha256-WSaIQZ5s9N9bDFkEMTw6P9eaZ9bv39ZhsiW12GtTNM0=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "e06bd4b64bbfda91d74f13cb5eca89485d47528f", + "rev": "1697b7d480449b01111e352021f46e5879e47643", "type": "github" }, "original": { @@ -36,6 +39,21 @@ "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index debdfd4..9f53c66 100644 --- a/flake.nix +++ b/flake.nix @@ -19,17 +19,13 @@ # This means we're effectively stuck with whichever version of GHC is both the # default for nixpkgs at some point in time - in the past is okay, as nixpkgs # is pinned and the cache is long-lived - and which has the requisite support -# in ghcup as well. At time of writing that version is 9.2.4. +# in ghcup as well. At time of writing that version is 9.4.6. # # Further complicating matters, GHC and HLS need to be sourced from the same # place to ensure that HLS was compiled against that same version of GHC, lest # we see "ABIs don't match" errors. Therefore aarch64-darwin contributors must # not only source HLS externally but also GHC. # -# But that's not all! A subset of Apple silicon contributors have reported being -# unable to run compiled 9.2.4 code. 9.2.5 fixes it. These users are encouraged -# to use 9.2.5 for the timebeing irrespective of the configuration here. -# # In short, don't upgrade GHC until it's the default in nixpkgs, and available # in ghcup and supported by HLS there as well. # @@ -45,7 +41,7 @@ flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; - ghcVer = "ghc924"; + ghcVer = "ghc946"; haskPkgs = pkgs.haskell.packages."${ghcVer}"; hask = if system == flake-utils.lib.system.aarch64-darwin diff --git a/intlc.cabal b/intlc.cabal index 8e0d9c3..936f029 100644 --- a/intlc.cabal +++ b/intlc.cabal @@ -14,7 +14,7 @@ common common ghc-options: -Wall build-depends: - base ^>=4.16 + base ^>=4.17 , bytestring ^>=0.11 , comonad ^>=5.0 , containers ^>=0.6 @@ -24,8 +24,8 @@ common common , free ^>=5.1 , mtl ^>=2.2 , recursion-schemes ^>=5.2 - , relude ^>=1.1 - , text ^>=1.2 + , relude ^>=1.2 + , text ^>=2.0 , validation ^>=1.1 mixins: base hiding (Prelude) @@ -48,7 +48,7 @@ library hs-source-dirs: lib/ build-depends: parser-combinators ^>=1.2 - , megaparsec ^>=9.0 + , megaparsec ^>=9.5 exposed-modules: Intlc.Compiler Intlc.Backend.JavaScript.Language @@ -79,10 +79,10 @@ test-suite test-intlc build-depends: intlc , filepath ^>=1.4 - , hspec ^>=2.7 + , hspec ^>=2.11 , hspec-golden ^>=0.2 , hspec-megaparsec ^>=2.2 - , megaparsec ^>=9.0 + , megaparsec ^>=9.5 , raw-strings-qq ^>=1.1 build-tool-depends: hspec-discover:hspec-discover From d874b0f8e2abfe2adc763f8c593cdb10ed7d986a Mon Sep 17 00:00:00 2001 From: "Sam A. Horvath-Hunt" Date: Wed, 13 Sep 2023 18:32:42 +0100 Subject: [PATCH 5/5] Source HLS on Apple Silicon too, at long last --- README.md | 2 +- flake.nix | 48 +++++++----------------------------------------- 2 files changed, 8 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 861fd34..7e79a6a 100644 --- a/README.md +++ b/README.md @@ -120,4 +120,4 @@ The description is optional and ignored by intlc. It can be used documentatively Check out `ARCHITECTURE.md`. -Currently building against GHC 9.2.4. A Nix flake is included with all necessary dependencies. Contributors on Apple silicon will need to source GHC and HLS externally, for example via ghcup. +Currently building against GHC 9.4.6. A Nix flake is included with all necessary dependencies. diff --git a/flake.nix b/flake.nix index 9f53c66..584000d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,36 +1,3 @@ -# There are two major considerations when picking a version of GHC for this -# project. -# -# Firstly, we'd like the version we choose to have tooling available in Nix's -# binary cache, without contributors having to mess around with additional -# caches. This limits us to the "default" version of GHC in nixpkgs. -# -# With this in mind, we could simply use the `ghc` and `haskellPackages` -# package and package set, however the following has been written with -# flexibility in mind. Note that using `haskellPackages` implicitly brings the -# default version of GHC into scope as it's merely an alias for the default -# package set [1]. -# -# Secondly, HLS is currently marked as broken on aarch64-darwin [2], which -# impacts Apple silicon contributors. With this in mind we're also keen to -# ensure that our chosen version of GHC is supported by HLS as distributed via -# ghcup. -# -# This means we're effectively stuck with whichever version of GHC is both the -# default for nixpkgs at some point in time - in the past is okay, as nixpkgs -# is pinned and the cache is long-lived - and which has the requisite support -# in ghcup as well. At time of writing that version is 9.4.6. -# -# Further complicating matters, GHC and HLS need to be sourced from the same -# place to ensure that HLS was compiled against that same version of GHC, lest -# we see "ABIs don't match" errors. Therefore aarch64-darwin contributors must -# not only source HLS externally but also GHC. -# -# In short, don't upgrade GHC until it's the default in nixpkgs, and available -# in ghcup and supported by HLS there as well. -# -# [1]: https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/haskell.section.md#available-packages-haskell-available-packages -# [2]: https://github.com/NixOS/nixpkgs/blob/a410420844fe1ad6415cf9586308fe7538cc7584/pkgs/development/compilers/llvm/7/compiler-rt/default.nix#L108 { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; @@ -41,19 +8,18 @@ flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; + # We'll stick with the "default" version of GHC in nixpkgs to benefit + # from the binary cache: + # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/haskell.section.md#available-packages-haskell-available-packages ghcVer = "ghc946"; - haskPkgs = pkgs.haskell.packages."${ghcVer}"; - hask = if system == flake-utils.lib.system.aarch64-darwin - then [ ] - else [ - pkgs.haskell.compiler."${ghcVer}" - haskPkgs.haskell-language-server - ]; + haskPkgs = pkgs.haskell.packages."${ghcVer}"; in { devShells.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ cabal-install + haskell.compiler."${ghcVer}" + haskPkgs.haskell-language-server hlint haskPkgs.hspec-golden stylish-haskell @@ -61,7 +27,7 @@ # For typechecking golden output nodejs yarn - ] ++ hask; + ]; }; }); }