Skip to content

Commit f2a3ee6

Browse files
authored
Add the tool plans to as hydraJobs (#172)
1 parent cb7c9fe commit f2a3ee6

File tree

5 files changed

+63
-30
lines changed

5 files changed

+63
-30
lines changed

cross-js.nix

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
{ self, pkgs, compiler, compiler-nix-name, toolsModule, withHLS ? true, withHlint ? true, withIOG ? true }:
22
let tool-version-map = import ./tool-map.nix;
3-
tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
4-
cabal-install = pkgs.haskell-nix.nix-tools-unchecked.exes.cabal;
3+
tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
4+
cabal-install = pkgs.pkgsBuildBuild.haskell-nix.nix-tools-unchecked.exes.cabal;
5+
haskell-tools =
6+
pkgs.lib.optionalAttrs (withHLS && (compiler-not-in (
7+
# it appears we can't get HLS build with 9.8 yet.
8+
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
9+
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) { hls = tool "haskell-language-server"; }
10+
// pkgs.lib.optionalAttrs (withHlint && (compiler-not-in (
11+
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name
12+
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) { hlint = tool "hlint"; };
513
# add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler.
614
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);
715

@@ -86,17 +94,17 @@ pkgs.mkShell ({
8694
(tool "alex")
8795
stdenv.cc.cc.lib ]) ++ (with pkgs.buildPackages; [
8896
])
89-
++ pkgs.lib.optional (withHLS && (compiler-not-in (
90-
# it appears we can't get HLS build with 9.8 yet.
91-
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
92-
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server")
93-
++ pkgs.lib.optional (withHlint && (compiler-not-in (
94-
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name
95-
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint")
97+
++ builtins.attrValues haskell-tools
9698
++ pkgs.lib.optional withIOG
9799
(with pkgs; [ cddl cbor-diag ]
98100
++ map pkgs.lib.getDev (with pkgs; [
99101
libblst libsodium-vrf secp256k1
100102
]))
101103
;
104+
105+
passthru = {
106+
plans = if haskell-tools == {} then {} else
107+
pkgs.pkgsBuildBuild.linkFarm "plans"
108+
(builtins.mapAttrs (_: t: t.project.plan-nix) haskell-tools);
109+
};
102110
})

cross-windows.nix

+15-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
let tool-version-map = import ./tool-map.nix;
33
tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
44
cabal-install = pkgs.pkgsBuildBuild.haskell-nix.nix-tools-unchecked.exes.cabal;
5+
haskell-tools =
6+
pkgs.lib.optionalAttrs (withHLS && (compiler-not-in (
7+
# it appears we can't get HLS build with 9.8 yet.
8+
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
9+
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) { hls = tool "haskell-language-server"; }
10+
// pkgs.lib.optionalAttrs (withHlint && (compiler-not-in (
11+
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name
12+
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) { hlint = tool "hlint"; };
513
# add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler.
614
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);
715
# Exclude zstd support for now, since it's currently broken on mingw32W64:
@@ -192,17 +200,17 @@ pkgs.pkgsBuildBuild.mkShell ({
192200
windows.mcfgthreads
193201
windows.mingw_w64_pthreads
194202
])
195-
++ pkgs.lib.optional (withHLS && (compiler-not-in (
196-
# it appears we can't get HLS build with 9.8 yet.
197-
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
198-
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server")
199-
++ pkgs.lib.optional (withHlint && (compiler-not-in (
200-
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name
201-
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint")
203+
++ builtins.attrValues haskell-tools
202204
++ pkgs.lib.optional withIOG
203205
(with pkgs.pkgsBuildBuild; [ cddl cbor-diag ]
204206
++ map pkgs.lib.getDev (with pkgs; [
205207
libblst libsodium-vrf secp256k1
206208
]))
207209
;
210+
211+
passthru = {
212+
plans = if haskell-tools == {} then {} else
213+
pkgs.pkgsBuildBuild.linkFarm "plans"
214+
(builtins.mapAttrs (_: t: t.project.plan-nix) haskell-tools);
215+
};
208216
})

dynamic.nix

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# define a development shell for dynamically linked applications (default)
22
{ self, pkgs, compiler, compiler-nix-name, toolsModule, withHLS ? true, withHlint ? true, withIOG ? true, withIOGFull ? false }:
33
let tool-version-map = import ./tool-map.nix;
4-
tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
5-
cabal-install = pkgs.haskell-nix.nix-tools-unchecked.exes.cabal;
4+
tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
5+
cabal-install = pkgs.pkgsBuildBuild.haskell-nix.nix-tools-unchecked.exes.cabal;
6+
haskell-tools =
7+
pkgs.lib.optionalAttrs (withHLS && (compiler-not-in (
8+
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
9+
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) { hls = tool "haskell-language-server"; }
10+
// pkgs.lib.optionalAttrs (withHlint && (compiler-not-in (
11+
pkgs.lib.optional (builtins.compareVersions compiler.version "9.10" >= 0) compiler-nix-name
12+
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) { hlint = tool "hlint"; };
613
# add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler.
714
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);
815

@@ -94,12 +101,7 @@ pkgs.mkShell {
94101
]
95102
++ pkgs.lib.optional pkgs.stdenv.hostPlatform.isLinux systemd
96103
)
97-
++ pkgs.lib.optional (withHLS && (compiler-not-in (
98-
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
99-
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server")
100-
++ pkgs.lib.optional (withHlint && (compiler-not-in (
101-
pkgs.lib.optional (builtins.compareVersions compiler.version "9.10" >= 0) compiler-nix-name
102-
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint")
104+
++ builtins.attrValues haskell-tools
103105
++ pkgs.lib.optional withIOG
104106
(with pkgs; [
105107
cddl
@@ -114,4 +116,10 @@ pkgs.mkShell {
114116
postgresql # for db-sync
115117
]))
116118
;
119+
120+
passthru = {
121+
plans = if haskell-tools == {} then {} else
122+
pkgs.pkgsBuildBuild.linkFarm "plans"
123+
(builtins.mapAttrs (_: t: t.project.plan-nix) haskell-tools);
124+
};
117125
}

flake.nix

+3-2
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,9 @@
251251
license = pkgs.lib.licenses.asl20;
252252
platforms = pkgs.lib.platforms.unix;
253253
};
254-
})) devShells) // {
255-
};
254+
})) devShells)
255+
// (pkgs.lib.mapAttrs' (name: drv:
256+
pkgs.lib.nameValuePair "${name}-plans" drv.plans) devShells);
256257
packages.cabalProjectLocal.static = (import ./quirks.nix { pkgs = static-pkgs; static = true; }).template;
257258
packages.cabalProjectLocal.cross-js = (import ./quirks.nix { pkgs = js-pkgs; }).template;
258259
packages.cabalProjectLocal.cross-windows = (import ./quirks.nix { pkgs = windows-pkgs; }).template;

static.nix

+12-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
let tool-version-map = import ./tool-map.nix;
33
tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
44
cabal-install = pkgs.pkgsBuildBuild.haskell-nix.nix-tools-unchecked.exes.cabal;
5+
haskell-tools =
6+
pkgs.lib.optionalAttrs (withHLS && (compiler-not-in (
7+
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name) "Haskell Language Server")) { hls = tool "haskell-language-server"; }
8+
// pkgs.lib.optionalAttrs (withHlint && (compiler-not-in (
9+
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name) "HLint")) { hlint = tool "hlint"; };
510
# add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler.
611
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);
712

@@ -144,10 +149,13 @@ pkgs.mkShell (rec {
144149
(pkgs.pkg-config or pkgconfig)
145150
stdenv.cc.cc.lib ]) ++ (with pkgs.buildPackages; [
146151
])
147-
++ pkgs.lib.optional (withHLS && (compiler-not-in (
148-
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name) "Haskell Language Server")) (tool "haskell-language-server")
149-
++ pkgs.lib.optional (withHlint && (compiler-not-in (
150-
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name) "HLint")) (tool "hlint")
152+
++ builtins.attrValues haskell-tools
151153
++ pkgs.lib.optional withIOG (with pkgs; [ cddl cbor-diag ])
152154
;
155+
156+
passthru = {
157+
plans = if haskell-tools == {} then {} else
158+
pkgs.pkgsBuildBuild.linkFarm "plans"
159+
(builtins.mapAttrs (_: t: t.project.plan-nix) haskell-tools);
160+
};
153161
})

0 commit comments

Comments
 (0)