ci/default.nix

104 lines
3 KiB
Nix
Raw Normal View History

2024-09-04 08:36:31 +00:00
{
nixpkgs,
2024-09-05 13:49:12 +00:00
rand-testsuite-prs,
2024-09-04 08:36:31 +00:00
rust-template-prs,
}: let
pkgs = import nixpkgs {};
prs = with pkgs.lib;
concatLists (map (f: attrValues (builtins.fromJSON (builtins.readFile f))) [
2024-09-05 13:49:12 +00:00
rand-testsuite-prs
2024-09-04 08:36:31 +00:00
rust-template-prs
]);
prJobsets = with pkgs.lib;
listToAttrs (map (pr: {
name = "${pr.base.repo.name}-pr${toString pr.number}";
value = {
enabled = pr.state == "open";
hidden = true;
description = "${pr.base.repo.name} PR ${toString pr.number}: ${pr.title}";
nixexprinput = "component";
nixexprpath = "default.nix";
checkinterval = 3600;
schedulingshares =
if pr.user.id == 1
then 100
else 10;
enableemail = false;
emailoverride = "";
keepnr = 1;
inputs =
{
component = {
type = "git";
value = "${pr.head.repo.clone_url} ${pr.head.ref}";
emailresponsible = false;
};
}
// (
if hasPrefix "https://git.chir.rs/" pr.head.repo.clone_url
then {
gitea_status_repo = {
type = "string";
value = "component";
emailresponsible = false;
};
gitea_repo_owner = {
type = "string";
value = head (splitString "/" pr.head.repo.full_name);
emailresponsible = false;
};
gitea_repo_name = {
type = "string";
value = pr.head.repo.name;
emailresponsible = false;
};
}
else {}
);
};
})
prs);
projectJobsets = with pkgs.lib;
listToAttrs (map (repo: {
2024-09-05 13:49:12 +00:00
name = repo;
value = {
enabled = true;
visible = true;
description = repo;
nixexprinput = "component";
nixexprpath = "default.nix";
checkinterval = 3600;
schedulingshares = 100;
enableemail = false;
emailoverride = "";
keepnr = 1;
inputs = {
component = {
type = "git";
value = "https://git.chir.rs/ProcyOS/${repo} main";
emailresponsible = false;
};
gitea_status_repo = {
type = "string";
value = "component";
emailresponsible = false;
};
gitea_repo_owner = {
type = "string";
value = "ProcyOS";
emailresponsible = false;
};
gitea_repo_name = {
type = "string";
value = repo;
emailresponsible = false;
};
2024-09-04 08:36:31 +00:00
};
};
2024-09-05 13:49:12 +00:00
}) [
"rand_testsuite"
"rust-template"
]);
2024-09-04 08:36:31 +00:00
jobsets = prJobsets // projectJobsets;
in {jobsets = pkgs.writeText "jobsets.json" (builtins.toJSON jobsets);}