blob: 440fa7c7931e5a35cdfbbffca3a34d2fb0c54a4c (
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
67
68
69
70
71
72
73
74
75
|
{
perSystem = {
lib,
pkgs,
system,
config,
...
}: {
pre-commit.settings = {
hooks = {
actionlint.enable = true;
${config.formatter.pname}.enable = true;
deadnix.enable = true;
nil.enable = true;
prettier.enable = true;
rustfmt.enable = true;
statix.enable = true;
};
};
# a linkFarm of expected outputs for ci
checks = {
ciGate = let
/*
require self.checks for all systems
require self.packages for x86_64-linux
*/
required = builtins.concatMap builtins.attrValues (
[(builtins.removeAttrs config.checks ["ciGate"])]
++ lib.optionals (system == "x86_64-linux") [(builtins.removeAttrs config.packages ["default"])]
);
paths =
builtins.foldl'
(
acc: deriv: let
name = deriv.pname or deriv.name;
pathName =
# if im not sure why `acc?name` doesn't work here
if (builtins.elem name (builtins.attrNames acc))
then "${name}-1"
else name;
in
acc // {"${pathName}" = deriv.path or deriv.outPath;}
)
{}
required;
in
pkgs.linkFarm "ci-gate" paths;
};
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [
actionlint
nodePackages_latest.prettier
# rust
clippy
rustfmt
# nix
config.formatter
deadnix
nil
statix
];
inputsFrom = [config.packages.default];
};
};
formatter = pkgs.alejandra;
};
}
|