summaryrefslogtreecommitdiff
path: root/ci.nix
blob: f05fbed13524d98846f42947eb45f9f4f6494236 (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
{self, ...}: {
  perSystem = {
    lib,
    pkgs,
    system,
    config,
    ...
  }: let
    # get applicable system configurations
    configurations = lib.getAttrs ["darwinConfigurations" "homeConfigurations" "nixosConfigurations"] self;

    systems = lib.pipe (builtins.attrValues configurations) [
      (builtins.foldl' (acc: attr: acc // attr) {})
      (lib.filterAttrs (_: v: v.pkgs.system == system))
      (lib.mapAttrsToList (_: v: v.config.system.build.toplevel or v.activationPackage))
    ];
  in {
    checks = {
      ciGate = pkgs.runCommand "ci-gate" {
        nativeBuildInputs = lib.concatLists [
          systems
          # and other checks
          (builtins.attrValues (builtins.removeAttrs config.checks ["ciGate"]))
        ];
      } "touch $out";
    };
  };
}