summaryrefslogtreecommitdiff
path: root/ci.nix
blob: f3ec82ad36485776a4146d58c2448004952af044 (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
{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
      );
  };
}