From 5fb44b5dec1f5c8d2c1fdb6099dd8a06d1f77229 Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Fri, 10 Jan 2025 06:34:26 +0100 Subject: [PATCH] feat(ci/cd): Set up Hydra --- .hydra/jobsets.nix | 59 ++++++++++++++++++++++++++++++++++++++++++++++ .hydra/spec.json | 40 +++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 .hydra/jobsets.nix create mode 100644 .hydra/spec.json diff --git a/.hydra/jobsets.nix b/.hydra/jobsets.nix new file mode 100644 index 0000000..4d7d558 --- /dev/null +++ b/.hydra/jobsets.nix @@ -0,0 +1,59 @@ +{ + 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 <tmp <