ci/default.nix
Charlotte 🦝 Delenk ac69afd054
All checks were successful
Hydra jobsets Hydra build #25761 of procyos:.jobsets:jobsets
fix typo
2024-09-06 20:35:24 +02:00

106 lines
3.1 KiB
Nix

{
nixpkgs,
extra-math-prs,
rand-testsuite-prs,
rust-template-prs,
}: let
pkgs = import nixpkgs {};
prs = with pkgs.lib;
concatLists (map (f: attrValues (builtins.fromJSON (builtins.readFile f))) [
extra-math-prs
rand-testsuite-prs
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: {
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;
};
};
};
}) [
"extra_math"
"rand_testsuite"
"rust-template"
]);
jobsets = prJobsets // projectJobsets;
in {jobsets = pkgs.writeText "jobsets.json" (builtins.toJSON jobsets);}