Add outputs.checks (#138)

This commit is contained in:
Sridhar Ratnakumar 2023-04-08 10:17:39 -04:00 committed by GitHub
parent bae56fa984
commit c74e7c5967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 11 deletions

View File

@ -3,6 +3,7 @@
## `master`
- #134: Add `autoWire` option to control generation of flake outputs
- #138: Add `checks` to `outputs` submodule
## 0.2.0 (Mar 13, 2023)

View File

@ -32,7 +32,13 @@ in
'';
default = false;
};
drv = mkOption {
type = types.package;
readOnly = true;
description = ''
The `hlsCheck` derivation generated for this project.
'';
};
};
};
packageSubmodule = with types; submodule {
@ -136,13 +142,14 @@ in
The development shell derivation generated for this project.
'';
};
hlsCheck = mkOption {
type = types.package;
checks = mkOption {
type = types.lazyAttrsOf types.package;
readOnly = true;
description = ''
The `hlsCheck` derivation generated for this project.
The flake checks generated for this project.
'';
};
};
};
projectSubmodule = types.submoduleWith {
@ -310,9 +317,8 @@ in
checks =
mergeMapAttrs
(name: project:
lib.optionalAttrs (project.autoWire && project.devShell.enable && project.devShell.hlsCheck.enable) {
"${name}-hls" = project.outputs.hlsCheck;
})
lib.optionalAttrs project.autoWire project.outputs.checks
)
config.haskellProjects;
};
});

View File

@ -62,6 +62,11 @@ in
++ builtins.attrValues (config.devShell.extraLibraries p);
};
});
hlsCheck =
runCommandInSimulatedShell
devShell
self "${projectKey}-hls-check"
{ } "haskell-language-server";
in
{
outputs = {
@ -84,11 +89,12 @@ in
(name: _: finalPackages."${name}")
config.packages;
hlsCheck = runCommandInSimulatedShell
devShell
self "${projectKey}-hls-check"
{ } "haskell-language-server";
checks = lib.filterAttrs (_: v: v != null) {
"${name}-hls" = if (config.devShell.enable && config.devShell.hlsCheck.enable) then hlsCheck else null;
};
};
devShell.hlsCheck.drv = hlsCheck;
};
}