ci/default.nix
Charlotte 🦝 Delenk b258fa0284
All checks were successful
Hydra jobsets Hydra build #1789 of procyos:.jobsets:jobsets
remove nixpkgs input from the ci
2024-09-04 11:02:16 +02:00

103 lines
3 KiB
Nix

{
nixpkgs,
rust-template-prs,
}: let
pkgs = import nixpkgs {};
prs = with pkgs.lib;
concatLists (map (f: attrValues (builtins.fromJSON (builtins.readFile f))) [
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;
};
nixpkgs = {
type = "git";
value = "https://github.com/NixOS/nixpkgs.git";
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;
};
};
};
}) ["rust-template"]);
jobsets = prJobsets // projectJobsets;
in {jobsets = pkgs.writeText "jobsets.json" (builtins.toJSON jobsets);}