From 76b6547ebe6bd44dacac23c4cb31489fe72f9041 Mon Sep 17 00:00:00 2001 From: ahuston-0 <aliceghuston@gmail.com> Date: Sat, 20 Apr 2024 16:45:37 -0400 Subject: [PATCH] Get hydra changes ready for RAD-development Signed-off-by: ahuston-0 <aliceghuston@gmail.com> --- hydra/jobsets.nix | 37 ++++++++++--------------- hydra/spec.json | 8 +++--- systems/palatine-hill/configuration.nix | 9 +----- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/hydra/jobsets.nix b/hydra/jobsets.nix index 5c1642a..e7f4dd5 100644 --- a/hydra/jobsets.nix +++ b/hydra/jobsets.nix @@ -2,12 +2,12 @@ nixpkgs, pulls, branches, - ... }: let pkgs = import nixpkgs { }; + # create the json spec for the jobset makeSpec = contents: builtins.derivation { @@ -26,8 +26,9 @@ let prs = readJSONFile pulls; refs = readJSONFile branches; - repo = "ahuston-0/nix-dotfiles-hydra"; + repo = "RAD-development/nix-dotfiles"; + # template for creating a job makeJob = { schedulingshares ? 10, @@ -49,6 +50,8 @@ let enableemail = false; emailoverride = ""; }; + + # Create a hydra job for a branch jobOfRef = name: { ref, ... }: @@ -62,6 +65,8 @@ let flake = "git+ssh://git@github.com/${repo}?ref=${ref}"; }; }; + + # Create a hydra job for a PR jobOfPR = id: info: { name = "pr-${id}"; value = makeJob { @@ -69,35 +74,21 @@ let flake = "git+ssh://git@github.com/${info.head.repo.full_name}?ref=${info.head.ref}"; }; }; + + # some utility functions + # converts json to name/value dicts attrsToList = l: builtins.attrValues (builtins.mapAttrs (name: value: { inherit name value; }) l); + # wrapper function for reading json from file readJSONFile = f: builtins.fromJSON (builtins.readFile f); + # remove null values from a set, in-case of branches that don't exist mapFilter = f: l: builtins.filter (x: !(isNull x)) (map f l); + + # Create job set from PRs and branches jobs = makeSpec ( builtins.listToAttrs (map ({ name, value }: jobOfPR name value) (attrsToList prs)) // builtins.listToAttrs (mapFilter ({ name, value }: jobOfRef name value) (attrsToList refs)) - // { - main = makeJob { - description = "main"; - flake = "github:${repo}"; - keepnr = 10; - schedulingshares = 100; - }; - } ); - log = { - jobsets = jobs; - }; in { jobsets = jobs; - # // pkgs.runCommand "spec-jobsets.json" { } '' - # cat >$out <<EOF - # ${jobs} - # EOF - # # This is to get nice .jobsets build logs on Hydra - # cat >tmp <<EOF - # ${builtins.toJSON log} - # EOF - # ${pkgs.jq}/bin/jq . tmp - # ''; } diff --git a/hydra/spec.json b/hydra/spec.json index 4735faf..9cd71f2 100644 --- a/hydra/spec.json +++ b/hydra/spec.json @@ -1,7 +1,7 @@ { "enabled": 1, "hidden": false, - "description": "system flake", + "description": "RAD Development infrastructure", "nixexprinput": "nixexpr", "nixexprpath": "hydra/jobsets.nix", "checkinterval": 60, @@ -12,7 +12,7 @@ "type": 0, "inputs": { "nixexpr": { - "value": "https://github.com/ahuston-0/nix-dotfiles-hydra main", + "value": "https://github.com/RAD-development/nix-dotfiles main", "type": "git", "emailresponsible": false }, @@ -23,12 +23,12 @@ }, "pulls": { "type": "githubpulls", - "value": "ahuston-0 nix-dotfiles-hydra", + "value": "RAD-development nix-dotfiles", "emailresponsible": false }, "branches": { "type": "github_refs", - "value": "ahuston-0 nix-dotfiles-hydra heads -", + "value": "RAD-development nix-dotfiles heads -", "emailresponsible": false } } diff --git a/systems/palatine-hill/configuration.nix b/systems/palatine-hill/configuration.nix index dd4d241..c7b0301 100644 --- a/systems/palatine-hill/configuration.nix +++ b/systems/palatine-hill/configuration.nix @@ -1,9 +1,4 @@ -{ - config, - lib, - pkgs, - ... -}: +{ config, pkgs, ... }: let keygen = key: { "${key}" = { @@ -240,8 +235,6 @@ in "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINHtwvfXg/QFjMAjC4JRjlMAaGPgEfSyhpprNpqbGSJn hydra-queue-runner@palatine-hill" ]; - system.autoUpgrade.flake = lib.mkForce "github:ahuston-0/nix-dotfiles-hydra"; - nix.gc.options = "--delete-older-than 150d"; sops = {