Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the tool plans to as hydraJobs #172

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions cross-js.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{ self, pkgs, compiler, compiler-nix-name, toolsModule, withHLS ? true, withHlint ? true, withIOG ? true }:
let tool-version-map = import ./tool-map.nix;
tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
cabal-install = pkgs.haskell-nix.nix-tools-unchecked.exes.cabal;
tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
cabal-install = pkgs.pkgsBuildBuild.haskell-nix.nix-tools-unchecked.exes.cabal;
haskell-tools =
pkgs.lib.optionalAttrs (withHLS && (compiler-not-in (
# it appears we can't get HLS build with 9.8 yet.
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) { hls = tool "haskell-language-server"; }
// pkgs.lib.optionalAttrs (withHlint && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) { hlint = tool "hlint"; };
# add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler.
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);

Expand Down Expand Up @@ -86,17 +94,17 @@ pkgs.mkShell ({
(tool "alex")
stdenv.cc.cc.lib ]) ++ (with pkgs.buildPackages; [
])
++ pkgs.lib.optional (withHLS && (compiler-not-in (
# it appears we can't get HLS build with 9.8 yet.
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server")
++ pkgs.lib.optional (withHlint && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint")
++ builtins.attrValues haskell-tools
++ pkgs.lib.optional withIOG
(with pkgs; [ cddl cbor-diag ]
++ map pkgs.lib.getDev (with pkgs; [
libblst libsodium-vrf secp256k1
]))
;

passthru = {
plans = if haskell-tools == {} then {} else
pkgs.pkgsBuildBuild.linkFarm "plans"
(builtins.mapAttrs (_: t: t.project.plan-nix) haskell-tools);
};
})
22 changes: 15 additions & 7 deletions cross-windows.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
let tool-version-map = import ./tool-map.nix;
tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
cabal-install = pkgs.pkgsBuildBuild.haskell-nix.nix-tools-unchecked.exes.cabal;
haskell-tools =
pkgs.lib.optionalAttrs (withHLS && (compiler-not-in (
# it appears we can't get HLS build with 9.8 yet.
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) { hls = tool "haskell-language-server"; }
// pkgs.lib.optionalAttrs (withHlint && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) { hlint = tool "hlint"; };
# add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler.
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);
# Exclude zstd support for now, since it's currently broken on mingw32W64:
Expand Down Expand Up @@ -192,17 +200,17 @@ pkgs.pkgsBuildBuild.mkShell ({
windows.mcfgthreads
windows.mingw_w64_pthreads
])
++ pkgs.lib.optional (withHLS && (compiler-not-in (
# it appears we can't get HLS build with 9.8 yet.
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server")
++ pkgs.lib.optional (withHlint && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint")
++ builtins.attrValues haskell-tools
++ pkgs.lib.optional withIOG
(with pkgs.pkgsBuildBuild; [ cddl cbor-diag ]
++ map pkgs.lib.getDev (with pkgs; [
libblst libsodium-vrf secp256k1
]))
;

passthru = {
plans = if haskell-tools == {} then {} else
pkgs.pkgsBuildBuild.linkFarm "plans"
(builtins.mapAttrs (_: t: t.project.plan-nix) haskell-tools);
};
})
24 changes: 16 additions & 8 deletions dynamic.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# define a development shell for dynamically linked applications (default)
{ self, pkgs, compiler, compiler-nix-name, toolsModule, withHLS ? true, withHlint ? true, withIOG ? true, withIOGFull ? false }:
let tool-version-map = import ./tool-map.nix;
tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
cabal-install = pkgs.haskell-nix.nix-tools-unchecked.exes.cabal;
tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
cabal-install = pkgs.pkgsBuildBuild.haskell-nix.nix-tools-unchecked.exes.cabal;
haskell-tools =
pkgs.lib.optionalAttrs (withHLS && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) { hls = tool "haskell-language-server"; }
// pkgs.lib.optionalAttrs (withHlint && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.10" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) { hlint = tool "hlint"; };
# add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler.
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);

Expand Down Expand Up @@ -94,12 +101,7 @@ pkgs.mkShell {
]
++ pkgs.lib.optional pkgs.stdenv.hostPlatform.isLinux systemd
)
++ pkgs.lib.optional (withHLS && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "Haskell Language Server")) (tool "haskell-language-server")
++ pkgs.lib.optional (withHlint && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.10" >= 0) compiler-nix-name
++ pkgs.lib.optional (pkgs.stdenv.hostPlatform.isDarwin && pkgs.stdenv.hostPlatform.isAarch64) "ghc902") "HLint")) (tool "hlint")
++ builtins.attrValues haskell-tools
++ pkgs.lib.optional withIOG
(with pkgs; [
cddl
Expand All @@ -114,4 +116,10 @@ pkgs.mkShell {
postgresql # for db-sync
]))
;

passthru = {
plans = if haskell-tools == {} then {} else
pkgs.pkgsBuildBuild.linkFarm "plans"
(builtins.mapAttrs (_: t: t.project.plan-nix) haskell-tools);
};
}
5 changes: 3 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@
license = pkgs.lib.licenses.asl20;
platforms = pkgs.lib.platforms.unix;
};
})) devShells) // {
};
})) devShells)
// (pkgs.lib.mapAttrs' (name: drv:
pkgs.lib.nameValuePair "${name}-plans" drv.plans) devShells);
packages.cabalProjectLocal.static = (import ./quirks.nix { pkgs = static-pkgs; static = true; }).template;
packages.cabalProjectLocal.cross-js = (import ./quirks.nix { pkgs = js-pkgs; }).template;
packages.cabalProjectLocal.cross-windows = (import ./quirks.nix { pkgs = windows-pkgs; }).template;
Expand Down
16 changes: 12 additions & 4 deletions static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
let tool-version-map = import ./tool-map.nix;
tool = tool-name: pkgs.pkgsBuildBuild.haskell-nix.tool compiler-nix-name tool-name [(tool-version-map compiler-nix-name tool-name) toolsModule];
cabal-install = pkgs.pkgsBuildBuild.haskell-nix.nix-tools-unchecked.exes.cabal;
haskell-tools =
pkgs.lib.optionalAttrs (withHLS && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name) "Haskell Language Server")) { hls = tool "haskell-language-server"; }
// pkgs.lib.optionalAttrs (withHlint && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name) "HLint")) { hlint = tool "hlint"; };
# add a trace helper. This will trace a message about disabling a component despite requesting it, if it's not supported in that compiler.
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);

Expand Down Expand Up @@ -144,10 +149,13 @@ pkgs.mkShell (rec {
(pkgs.pkg-config or pkgconfig)
stdenv.cc.cc.lib ]) ++ (with pkgs.buildPackages; [
])
++ pkgs.lib.optional (withHLS && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.7" >= 0) compiler-nix-name) "Haskell Language Server")) (tool "haskell-language-server")
++ pkgs.lib.optional (withHlint && (compiler-not-in (
pkgs.lib.optional (builtins.compareVersions compiler.version "9.8" >= 0) compiler-nix-name) "HLint")) (tool "hlint")
++ builtins.attrValues haskell-tools
++ pkgs.lib.optional withIOG (with pkgs; [ cddl cbor-diag ])
;

passthru = {
plans = if haskell-tools == {} then {} else
pkgs.pkgsBuildBuild.linkFarm "plans"
(builtins.mapAttrs (_: t: t.project.plan-nix) haskell-tools);
};
})
Loading