Skip to content

Commit 9ae791c

Browse files
committed
Pin Nix GHC minor version
Pins down the GHC version down to the minor version. As discussed in a PR in clash-cores (clash-lang/clash-cores#44 (comment)). Each supported GHC version is now postfixed with a minor version number. However the overlays are not. The last digit of the version number gets stripped when Nix imports an overlay. This way we can have one set of GHC version numbers pin down the right GHC version *and* import the right overlay. I `nix build .#clash-ghc` with all three versions succesfully.
1 parent 1328c34 commit 9ae791c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Or [use Nix](https://nixos.org/nix/download.html) to get a shell with the `clash
116116
nix develop .
117117

118118
# Start a dev shell with a specific GHC version
119-
nix develop .#ghc961
119+
nix develop .#ghc9101
120120
```
121121

122122
You will need a modern version of nix with support for the new-style `nix`

flake.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
# The versions of GHC that we want to be able to build / develop against
3737
# within the nix environment. Since nix is lazy, only derivations for
3838
# versions of GHC which are used are actually evaluated.
39-
ghcVersions = [ "ghc902" "ghc962" ];
39+
ghcVersions = [ "ghc964" "ghc982" "ghc9101" ];
4040

4141
# We pick a single version of GHC to use by default within nix. This is
4242
# probably cleaner than always having N copies of each package / app and
4343
# being forced to refer to them by their GHC version.
44-
defaultGhcVersion = "ghc962";
44+
defaultGhcVersion = "ghc9101";
4545

4646
# Overlays are not per-system, so let's only compute them once.
4747
# For each version of GHC we produce a `pkgs.clashPackages-ghcVER`, e.g.

nix/overlay.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ compilerVersion:
1515
final: prev:
1616
let
1717
# An overlay with the things we need to change for the specified GHC version.
18-
ghcOverlay = import (./. + "/overlay-${compilerVersion}.nix") {
18+
# The overlays are named without the GHC minor version, so we need to strip the last character from the version
19+
strippedMinorVersion = builtins.substring 0 (builtins.stringLength compilerVersion - 1) compilerVersion;
20+
ghcOverlay = import (./. + "/overlay-${strippedMinorVersion}.nix") {
1921
pkgs = prev;
2022
};
2123

0 commit comments

Comments
 (0)