|
7 | 7 | # nixpkgs to use.
|
8 | 8 | pkgs,
|
9 | 9 |
|
| 10 | + # ghc to use; only because without a GHC on path, stack complains: |
| 11 | + # stack2nix: No compiler found, expected minor version match with ghc-8.10.4 (x86_64) (based on resolver setting ... |
| 12 | + # This happens even when using the Stack API (as stack2nix does), |
| 13 | + # and stack2nix doen't currently accept or set the `--system-ghc` |
| 14 | + # flag to skip the check (maybe it should to eschew this option; |
| 15 | + # I suspect our operation here never uses GHC). |
| 16 | + # TODO: This shouldn't be necessary since `stack2nix` commit |
| 17 | + # Set `--system-ghc` via stack API. |
| 18 | + # But somehow stack2nix still complains about it; |
| 19 | + # perhaps we didn't use the Stack API correctly. |
| 20 | + compiler, |
| 21 | + |
10 | 22 | # Path to directory containing `stack.yaml`.
|
11 | 23 | stack-project-dir,
|
12 | 24 |
|
|
47 | 59 | "${pkgs.cabal-install}/bin" # `cabal`
|
48 | 60 | "${pkgs.nix}/bin" # various `nix-*` commands
|
49 | 61 | "${pkgs.wget}/bin" # `wget`
|
| 62 | + "${pkgs.haskell.compiler.${compiler}}/bin" # `ghc` version matching target stack.yaml |
50 | 63 | ];
|
51 | 64 |
|
52 | 65 | fixed_stack2nix =
|
53 |
| - let |
54 |
| - # stack2nix isn't compatible with Stack >= 2.0, see |
55 |
| - # https://github.com/input-output-hk/stack2nix/issues/168. |
56 |
| - # Current versions of nixpkgs master have Stack >= 2.0, see |
57 |
| - # https://github.com/NixOS/nixpkgs/issues/63691. |
58 |
| - # We thus fetch the `stack2nix` binary from an older nixpkgs version |
59 |
| - # that doesn't have Stack >= 2.0. |
60 |
| - # This means that `static-stack2nix-builder` may not work on `stack.yaml` |
61 |
| - # files that aren't compatible with Stack < 2.0. |
62 |
| - stack2nix_pkgs = import (fetchTarball https://github.com/NixOS/nixpkgs/archive/e36f91fa86109fa93cac2516a9365af57233a3a6.tar.gz) {}; |
63 |
| - in |
64 |
| - # Some older stack2nix versions have fundamental problems that prevent |
65 |
| - # stack2nix from running correctly. Fix them here, until these old versions |
66 |
| - # are faded out of current nixpkgs. Especially: |
67 |
| - # * "Make sure output is written in UTF-8." |
68 |
| - # https://github.com/input-output-hk/stack2nix/commit/cb05818ef8b58899f15641f50cb04e5473b4f9b0 |
69 |
| - # * "Make GHC base libraries dependent on GHC version." |
70 |
| - # https://github.com/input-output-hk/stack2nix/pull/172/commits |
71 |
| - # |
72 |
| - # Versions < 0.2.4 aren't supported, force-upgrade them to 0.2.4. |
73 |
| - if stack2nix_pkgs.lib.versionOlder stack2nix_pkgs.stack2nix.version "0.2.4" |
74 |
| - then stack2nix_pkgs.haskellPackages.callCabal2nix "stack2nix" (stack2nix_pkgs.fetchFromGitHub { |
75 |
| - owner = "nh2"; |
76 |
| - repo = "stack2nix"; |
77 |
| - rev = "c009e33af30c76b8fe94388382d816079fb5ac4e"; |
78 |
| - sha256 = "0x0hjzjlx1a0pyjd8aalk3ajwcymsb2qd65n2sqdhpy9bdsz8vxl"; |
79 |
| - }) {} |
80 |
| - else stack2nix_pkgs.stack2nix; |
| 66 | + pkgs.haskellPackages.callCabal2nix "stack2nix" (pkgs.fetchFromGitHub { |
| 67 | + owner = "nh2"; |
| 68 | + repo = "stack2nix"; |
| 69 | + rev = "c20097d4edf82256484a733544579d4b5e0f2808"; |
| 70 | + sha256 = "1lpwc20q62z9a9fpksd9q10x1jz8l29psx4dqsff759srj4chy9p"; |
| 71 | + }) {}; |
81 | 72 | in
|
82 | 73 | pkgs.writeShellScript "stack2nix-build-script.sh" ''
|
83 | 74 | set -eu -o pipefail
|
|
0 commit comments