Skip to content

Commit e49b15f

Browse files
authored
Choose proper llvm version for llvm-hs and make stack infra work like stack does (#1724)
* update llvm-hs llvm from 11 to 12 * allow passing version args to build-tools; fix llvm-hs build-tools, pass allRefs to builtins.fetchGit to allow fetching non-standard-refs (to mirror stack behaviour)
1 parent d20fc9d commit e49b15f

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

builder/comp-builder.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,16 @@ let
235235
"--ghc-options=-j1"
236236
);
237237

238+
# the build-tools version might be depending on the version of the package, similarly to patches
238239
executableToolDepends =
239240
(lib.concatMap (c: if c.isHaskell or false
240241
then builtins.attrValues (c.components.exes or {})
241-
else [c]) build-tools) ++
242+
else [c])
243+
(builtins.filter (x: !(isNull x))
244+
(map
245+
(p: if builtins.isFunction p
246+
then p { inherit (package.identifier) version; inherit revision; }
247+
else p) build-tools))) ++
242248
lib.optional (pkgconfig != []) buildPackages.cabalPkgConfigWrapper;
243249

244250
# Unfortunately, we need to wrap ghc commands for cabal builds to

builder/setup-builder.nix

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,18 @@ let
3434
;
3535
};
3636

37-
executableToolDepends =
37+
# the build-tools version might be depending on the version of the package, similarly to patches
38+
executableToolDepends =
39+
let inherit (component) pkgconfig build-tools; in
3840
(lib.concatMap (c: if c.isHaskell or false
3941
then builtins.attrValues (c.components.exes or {})
40-
else [c]) component.build-tools) ++
41-
lib.optional (component.pkgconfig != []) buildPackages.cabalPkgConfigWrapper;
42+
else [c])
43+
(builtins.filter (x: !(isNull x))
44+
(map
45+
(p: if builtins.isFunction p
46+
then p { inherit (package.identifier) version; inherit revision; }
47+
else p) build-tools))) ++
48+
lib.optional (pkgconfig != []) buildPackages.cabalPkgConfigWrapper;
4249

4350
drv =
4451
stdenv.mkDerivation ({

lib/stack-cache-generator.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ concatMap (dep:
9898
else builtins.fetchGit ({
9999
inherit (dep) url rev;
100100
submodules = true;
101+
allRefs = true;
101102
} // evalPackages.lib.optionalAttrs (branch != null) { ref = branch; });
102103
in map (subdir: {
103104
name = cabalName "${pkgsrc}/${subdir}";

modules/configuration-nix.nix

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,18 @@ in {
9191

9292
packages.discount.components.library.libs = pkgs.lib.mkForce [ pkgs.discount ];
9393

94-
packages.llvm-hs.components.library.build-tools = pkgs.lib.mkForce [ pkgs.llvm ];
94+
packages.llvm-hs.components.library.build-tools = pkgs.lib.mkForce [
95+
(fromUntil "5.0.0" "6" pkgs.llvmPackages_5.llvm)
96+
(fromUntil "6.0.0" "7" pkgs.llvmPackages_6.llvm)
97+
(fromUntil "7.0.0" "8" pkgs.llvmPackages_7.llvm)
98+
(fromUntil "8.0.0" "9" pkgs.llvmPackages_8.llvm)
99+
(fromUntil "9.0.0" "12" pkgs.llvmPackages_9.llvm)
100+
(fromUntil "12.0.0" "15" pkgs.llvmPackages_12.llvm)
101+
# NOTE: we currently don't have a llvm versoin > 12 that has a tag
102+
# in nixpkgs, so we probably can't build `llvm-hs > 12`, there
103+
# is however a head version of llvm in nixpkgs, which we might
104+
# be able to use if that case were to occur
105+
];
95106

96107
packages.BNFC.components.tests.doctests.build-tools = [
97108
config.hsPkgs.buildPackages.alex

0 commit comments

Comments
 (0)