add hydra build code

This commit is contained in:
Charlotte 🦝 Delenk 2024-11-26 08:49:02 +01:00
parent 664f0bc626
commit 32a4171ca2
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
4 changed files with 134 additions and 0 deletions

11
default.nix Normal file
View file

@ -0,0 +1,11 @@
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url =
lock.nodes.flake-compat.locked.url
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
) { src = ./.; }).defaultNix

1
hydra/default.nix Normal file
View file

@ -0,0 +1 @@
{ chir-rs }: (import chir-rs).hydraJobs

81
hydra/jobsets.nix Normal file
View file

@ -0,0 +1,81 @@
{
prsJSON,
nixpkgs,
}:
let
pkgs = import nixpkgs { };
prs = builtins.fromJSON (builtins.readFile prsJSON);
jobsets =
(builtins.listToAttrs (
pkgs.lib.attrsets.mapAttrsToList (_: info: {
name = "pr${toString info.number}";
value = {
enabled = info.state == "open";
hidden = info.state != "open";
description = "PR ${toString info.number}: ${info.title}";
nixexprinput = "chir-rs";
nixexprpath = "hydra/default.nix";
checkinterval = 3600;
schedulingshares = 100;
enableemail = false;
emailoverride = "";
keepnr = 1;
inputs = {
chir-rs = {
type = "git";
value = "${info.head.repo.clone_url} ${info.head.ref}";
emailresponsible = false;
};
gitea_status_repo = {
type = "string";
value = "chir-rs";
};
gitea_repo_owner = {
type = "string";
value = info.head.repo.owner.login;
};
gitea_repo_name = {
type = "string";
value = info.head.repo.name;
};
};
};
}) prs
))
// {
chir-rs = {
enabled = 1;
hidden = false;
description = "Current nixos config";
nixexprinput = "chir-rs";
nixexprpath = "hydra/default.nix";
checkinterval = 0;
schedulingshares = 100;
enableemail = false;
emailoverride = "";
keepnr = 1;
inputs = {
chir-rs = {
type = "git";
value = "https://git.chir.rs/darkkirb/chir-rs main";
emailresponsible = false;
};
gitea_status_repo = {
type = "string";
value = "chir-rs";
};
gitea_repo_owner = {
type = "string";
value = "Darkkirb";
};
gitea_repo_name = {
type = "string";
value = "chir-rs";
};
};
};
};
in
{
jobsets = pkgs.writeText "jobsets.json" (builtins.toJSON jobsets);
}

41
hydra/spec.json Normal file
View file

@ -0,0 +1,41 @@
{
"enabled": 1,
"hidden": false,
"description": "jobsets",
"nixexprinput": "chir-rs",
"nixexprpath": "hydra/jobsets.nix",
"checkinterval": 3600,
"schedulingshares": 100,
"enableemail": false,
"emailoverride": "",
"keepnr": 1,
"inputs": {
"chir-rs": {
"type": "git",
"value": "https://git.chir.rs/darkkirb/chir-rs.git main",
"emailresponsible": false
},
"nixpkgs": {
"type": "git",
"value": "https://github.com/NixOS/nixpkgs.git",
"emailresponsible": false
},
"prsJSON": {
"type": "giteapulls",
"value": "git.chir.rs darkkirb chir-rs",
"emailresponsible": false
},
"gitea_status_repo": {
"type": "string",
"value": "chir-rs"
},
"gitea_repo_owner": {
"type": "string",
"value": "darkkirb"
},
"gitea_repo_name": {
"type": "string",
"value": "chir-rs"
}
}
}