summaryrefslogtreecommitdiff
path: root/parts/ci.nix
blob: 5ddc81caa992a589d759eb80c85421aadef24053 (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
{self, ...}: {
  perSystem = {
    lib,
    pkgs,
    system,
    self',
    ...
  }: {
    packages = {
      ciGate = let
        toTopLevel = cfg: cfg.config.system.build.toplevel or cfg.activationPackage;
        isCompatible = cfg: cfg.pkgs.system == system;

        configurations =
          map
          (type:
            lib.mapAttrs (lib.const toTopLevel)
            (lib.filterAttrs (lib.const isCompatible) self.${type}))
          [
            "nixosConfigurations"
            "darwinConfigurations"
            "homeConfigurations"
          ];

        required = lib.concatMap lib.attrValues (
          lib.flatten [self'.checks self'.devShells configurations]
        );
      in
        pkgs.writeText "ci-gate" (
          lib.concatMapStringsSep "\n" toString required
        );
    };
  };
}