nixos-mailserver/.hydra/declarative-jobsets.nix

56 lines
1.3 KiB
Nix
Raw Permalink Normal View History

{ nixpkgs, pulls, ... }:
let
pkgs = import nixpkgs {};
prs = builtins.fromJSON (builtins.readFile pulls);
prJobsets = pkgs.lib.mapAttrs (num: info:
{ enabled = 1;
hidden = false;
description = "PR ${num}: ${info.title}";
checkinterval = 30;
schedulingshares = 20;
enableemail = false;
emailoverride = "";
keepnr = 1;
type = 1;
flake = "gitlab:simple-nixos-mailserver/nixos-mailserver/merge-requests/${info.iid}/head";
}
) prs;
mkFlakeJobset = branch: {
2021-06-06 09:52:00 +02:00
description = "Build ${branch} branch of Simple NixOS MailServer";
checkinterval = "60";
enabled = "1";
schedulingshares = 100;
enableemail = false;
emailoverride = "";
keepnr = 3;
hidden = false;
type = 1;
flake = "gitlab:simple-nixos-mailserver/nixos-mailserver/${branch}";
2022-02-20 11:29:33 +01:00
};
2021-06-06 09:52:00 +02:00
desc = prJobsets // {
"master" = mkFlakeJobset "master";
2023-12-19 23:07:52 +01:00
"nixos-23.11" = mkFlakeJobset "nixos-23.11";
2024-06-03 11:57:22 +02:00
"nixos-24.05" = mkFlakeJobset "nixos-24.05";
};
log = {
pulls = prs;
jobsets = desc;
};
in {
jobsets = pkgs.runCommand "spec-jobsets.json" {} ''
cat >$out <<EOF
${builtins.toJSON desc}
EOF
# This is to get nice .jobsets build logs on Hydra
cat >tmp <<EOF
${builtins.toJSON log}
EOF
${pkgs.jq}/bin/jq . tmp
'';
}