2021-05-27 21:03:20 +00:00
|
|
|
{ nixpkgs, pulls, ... }:
|
2020-04-17 23:03:15 +00:00
|
|
|
|
|
|
|
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;
|
2021-07-10 14:05:25 +00:00
|
|
|
type = 1;
|
|
|
|
flake = "gitlab:simple-nixos-mailserver/nixos-mailserver/merge-requests/${info.iid}/head";
|
2020-04-17 23:03:15 +00:00
|
|
|
}
|
|
|
|
) prs;
|
2022-01-21 12:02:15 +00:00
|
|
|
# This could be removed once branch 21.11 would have been
|
2021-07-12 21:28:02 +00:00
|
|
|
# removed.
|
2021-06-06 07:52:00 +00:00
|
|
|
mkJobset = branch: {
|
2021-07-12 21:28:02 +00:00
|
|
|
description = "Build ${branch} branch of Simple NixOS MailServer";
|
|
|
|
checkinterval = "60";
|
|
|
|
enabled = "1";
|
|
|
|
schedulingshares = 100;
|
|
|
|
enableemail = false;
|
|
|
|
emailoverride = "";
|
|
|
|
nixexprinput = "snm";
|
|
|
|
nixexprpath = ".hydra/default.nix";
|
|
|
|
type = 0;
|
|
|
|
inputs = {
|
|
|
|
# This is only used to allow Niv to use pkgs.fetchzip which is
|
|
|
|
# required because of Hydra restricted evaluation mode.
|
|
|
|
nixpkgs = {
|
|
|
|
value = "https://github.com/NixOS/nixpkgs b6eefa48d8e10491e43c0c6155ac12b463f6fed3";
|
|
|
|
type = "git";
|
|
|
|
emailresponsible = false;
|
|
|
|
};
|
|
|
|
snm = {
|
|
|
|
value = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver ${branch}";
|
|
|
|
type = "git";
|
|
|
|
emailresponsible = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
keepnr = 3;
|
|
|
|
hidden = false;
|
|
|
|
};
|
|
|
|
mkFlakeJobset = branch: {
|
2021-06-06 07:52:00 +00:00
|
|
|
description = "Build ${branch} branch of Simple NixOS MailServer";
|
|
|
|
checkinterval = "60";
|
|
|
|
enabled = "1";
|
|
|
|
schedulingshares = 100;
|
|
|
|
enableemail = false;
|
|
|
|
emailoverride = "";
|
|
|
|
keepnr = 3;
|
|
|
|
hidden = false;
|
2021-07-10 14:05:25 +00:00
|
|
|
type = 1;
|
|
|
|
flake = "gitlab:simple-nixos-mailserver/nixos-mailserver/${branch}";
|
2022-02-20 10:29:33 +00:00
|
|
|
};
|
2021-06-06 07:52:00 +00:00
|
|
|
|
|
|
|
desc = prJobsets // {
|
2021-07-12 21:28:02 +00:00
|
|
|
"master" = mkFlakeJobset "master";
|
2022-02-20 10:29:33 +00:00
|
|
|
"nixos-21.11" = mkFlakeJobset "nixos-21.11";
|
2020-04-17 23:03:15 +00:00
|
|
|
};
|
|
|
|
|
2021-07-10 14:05:25 +00:00
|
|
|
log = {
|
|
|
|
pulls = prs;
|
|
|
|
jobsets = desc;
|
|
|
|
};
|
|
|
|
|
2020-04-17 23:03:15 +00:00
|
|
|
in {
|
|
|
|
jobsets = pkgs.runCommand "spec-jobsets.json" {} ''
|
|
|
|
cat >$out <<EOF
|
|
|
|
${builtins.toJSON desc}
|
|
|
|
EOF
|
2021-07-10 14:05:25 +00:00
|
|
|
# This is to get nice .jobsets build logs on Hydra
|
|
|
|
cat >tmp <<EOF
|
|
|
|
${builtins.toJSON log}
|
|
|
|
EOF
|
|
|
|
${pkgs.jq}/bin/jq . tmp
|
2020-04-17 23:03:15 +00:00
|
|
|
'';
|
|
|
|
}
|