From 32a4171ca26d50da3c83dd6e2488856caa25e14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Tue, 26 Nov 2024 08:49:02 +0100 Subject: [PATCH] add hydra build code --- default.nix | 11 +++++++ hydra/default.nix | 1 + hydra/jobsets.nix | 81 +++++++++++++++++++++++++++++++++++++++++++++++ hydra/spec.json | 41 ++++++++++++++++++++++++ 4 files changed, 134 insertions(+) create mode 100644 default.nix create mode 100644 hydra/default.nix create mode 100644 hydra/jobsets.nix create mode 100644 hydra/spec.json diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..1d976a3 --- /dev/null +++ b/default.nix @@ -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 diff --git a/hydra/default.nix b/hydra/default.nix new file mode 100644 index 0000000..c75a6fe --- /dev/null +++ b/hydra/default.nix @@ -0,0 +1 @@ +{ chir-rs }: (import chir-rs).hydraJobs diff --git a/hydra/jobsets.nix b/hydra/jobsets.nix new file mode 100644 index 0000000..3596889 --- /dev/null +++ b/hydra/jobsets.nix @@ -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); +} diff --git a/hydra/spec.json b/hydra/spec.json new file mode 100644 index 0000000..7ec50e5 --- /dev/null +++ b/hydra/spec.json @@ -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" + } + } +} \ No newline at end of file