blob: 63a85fe2be6c94039e49430688663fb31a2b6ba1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
{ flake-parts-lib, ... }:
{
options = {
perSystem = flake-parts-lib.mkPerSystemOption (
{
config,
lib,
pkgs,
...
}:
let
namespace = "quickChecks";
cfg = config.${namespace};
checkSubmodule =
{ config, name, ... }:
{
options = {
name = lib.mkOption {
type = lib.types.str;
default = "check-" + name;
description = "Name of the derivation used for the script.";
};
dependencies = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
description = "Packages used in the script.";
};
script = lib.mkOption {
type = lib.types.lines;
description = "Script to run as the check.";
};
package = lib.mkOption {
type = lib.types.package;
readOnly = true;
description = "Package that runs the check.";
};
};
config = {
package = pkgs.runCommand config.name { nativeBuildInputs = config.dependencies; } (
lib.concatLines [
config.script
"touch $out"
]
);
};
};
in
{
options.${namespace} = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule checkSubmodule);
default = { };
description = "An attribute set of check scripts.";
};
config = {
checks = lib.mapAttrs (lib.const (lib.getAttr "package")) cfg;
};
}
);
};
}
|