zsh.nix/.hydra/jobsets.nix
jiriks74 5fb44b5dec
All checks were successful
Perform checks / nix_flake_check (push) Successful in 46s
Perform checks / formatting (push) Successful in 47s
feat(ci/cd): Set up Hydra
2025-01-10 06:34:26 +01:00

59 lines
1.2 KiB
Nix

{
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 = 60;
schedulingshares = 20;
enableemail = false;
emailoverride = "";
keepnr = 1;
type = 1;
flake = "git+https://gitea.stefka.eu/jiriks74/zsh.nix/pull/${num}/head";
}
)
prs;
mkFlakeJobset = branch: {
description = "Build ${branch}";
checkinterval = "3600";
enabled = "1";
schedulingshares = 100;
enableemail = false;
emailoverride = "";
keepnr = 3;
hidden = false;
type = 1;
flake = "git+https://gitea.stefka.eu/jiriks74/zsh.nix/${branch}";
};
desc =
prJobsets
// {
"main" = mkFlakeJobset "main";
};
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
'';
}