From 3e7cd3b59d9a11e34abc8eae245b0977b046ad5a Mon Sep 17 00:00:00 2001 From: ahuston-0 Date: Wed, 26 Mar 2025 02:43:56 -0400 Subject: [PATCH] re-enable hydra --- flake.lock | 116 ++++++++++++++++-------- flake.nix | 15 ++- hydra/jobsets.nix | 39 ++++---- hydra/spec.json | 13 +-- systems/palatine-hill/configuration.nix | 3 +- systems/palatine-hill/default.nix | 1 - systems/palatine-hill/hydra.nix | 4 +- systems/palatine-hill/vars.nix | 1 - 8 files changed, 109 insertions(+), 83 deletions(-) diff --git a/flake.lock b/flake.lock index 67afa62..e6a0c6b 100644 --- a/flake.lock +++ b/flake.lock @@ -67,21 +67,6 @@ "type": "github" } }, - "crane": { - "locked": { - "lastModified": 1727316705, - "narHash": "sha256-/mumx8AQ5xFuCJqxCIOFCHTVlxHkMT21idpbgbm/TIE=", - "owner": "ipetkov", - "repo": "crane", - "rev": "5b03654ce046b5167e7b0bccbd8244cb56c16f0e", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, "firefox-addons": { "inputs": { "flake-utils": [ @@ -340,6 +325,28 @@ "type": "github" } }, + "hydra": { + "inputs": { + "nix": "nix", + "nix-eval-jobs": "nix-eval-jobs", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1739907437, + "narHash": "sha256-yBLVNhbGM/WmHUEa0mCw7mFfa5blxWZGlqP6F6PgQnY=", + "owner": "fx-chun", + "repo": "hydra", + "rev": "18c0d762109549351ecf622cde34514351a72492", + "type": "github" + }, + "original": { + "owner": "fx-chun", + "repo": "hydra", + "type": "github" + } + }, "hyprland-contrib": { "inputs": { "nixpkgs": [ @@ -360,6 +367,59 @@ "type": "github" } }, + "nix": { + "inputs": { + "flake-compat": [ + "hydra" + ], + "flake-parts": [ + "hydra" + ], + "git-hooks-nix": [ + "hydra" + ], + "nixpkgs": [ + "hydra", + "nixpkgs" + ], + "nixpkgs-23-11": [ + "hydra" + ], + "nixpkgs-regression": [ + "hydra" + ] + }, + "locked": { + "lastModified": 1739899400, + "narHash": "sha256-q/RgA4bB7zWai4oPySq9mch7qH14IEeom2P64SXdqHs=", + "owner": "NixOS", + "repo": "nix", + "rev": "e310c19a1aeb1ce1ed4d41d5ab2d02db596e0918", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "2.26-maintenance", + "repo": "nix", + "type": "github" + } + }, + "nix-eval-jobs": { + "flake": false, + "locked": { + "lastModified": 1739500569, + "narHash": "sha256-3wIReAqdTALv39gkWXLMZQvHyBOc3yPkWT2ZsItxedY=", + "owner": "nix-community", + "repo": "nix-eval-jobs", + "rev": "4b392b284877d203ae262e16af269f702df036bc", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-eval-jobs", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -555,6 +615,7 @@ "flake-parts": "flake-parts", "flake-utils": "flake-utils", "home-manager": "home-manager", + "hydra": "hydra", "hyprland-contrib": "hyprland-contrib", "nix-index-database": "nix-index-database", "nixos-generators": "nixos-generators", @@ -567,7 +628,6 @@ "sops-nix": "sops-nix", "stylix": "stylix", "systems": "systems_2", - "typhon": "typhon", "wired-notify": "wired-notify" } }, @@ -786,30 +846,6 @@ "type": "github" } }, - "typhon": { - "inputs": { - "crane": "crane", - "flake-compat": [ - "flake-compat" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1730373693, - "narHash": "sha256-pDoaV+a3CBmvhYKD/m8k5soQ4kxwzvv2Kh/y7QHCGyU=", - "owner": "typhon-ci", - "repo": "typhon", - "rev": "e4f11b3d7c47c3a584fe565637bcc6e50f3735da", - "type": "github" - }, - "original": { - "owner": "typhon-ci", - "repo": "typhon", - "type": "github" - } - }, "wired-notify": { "inputs": { "flake-parts": [ diff --git a/flake.nix b/flake.nix index 1f7851c..5526b55 100644 --- a/flake.nix +++ b/flake.nix @@ -58,6 +58,13 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + hydra = { + url = "github:fx-chun/hydra"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + hyprland-contrib = { url = "github:hyprwm/contrib"; inputs.nixpkgs.follows = "nixpkgs"; @@ -112,14 +119,6 @@ }; }; - typhon = { - url = "github:typhon-ci/typhon"; - inputs = { - flake-compat.follows = "flake-compat"; - nixpkgs.follows = "nixpkgs"; - }; - }; - wired-notify = { url = "github:Toqozz/wired-notify"; inputs = { diff --git a/hydra/jobsets.nix b/hydra/jobsets.nix index 96eaa9e..f1a4cfa 100644 --- a/hydra/jobsets.nix +++ b/hydra/jobsets.nix @@ -1,4 +1,4 @@ -{ pulls, branches, ... }: +{ pulls, ... }: let # create the json spec for the jobset makeSpec = @@ -18,8 +18,7 @@ let }; prs = readJSONFile pulls; - refs = readJSONFile branches; - repo = "RAD-Development/nix-dotfiles"; + # refs = readJSONFile branches; # template for creating a job makeJob = @@ -44,27 +43,27 @@ let emailoverride = ""; }; - # Create a hydra job for a branch - jobOfRef = - name: - { ref, ... }: - if ((builtins.match "^refs/heads/(.*)$" ref) == null) then - null - else - { - name = builtins.replaceStrings [ "/" ] [ "-" ] "branch-${name}"; - value = makeJob { - description = "Branch ${name}"; - flake = "git+ssh://git@github.com/${repo}?ref=${ref}"; - }; - }; + # # Create a hydra job for a branch + # jobOfRef = + # name: + # { ref, ... }: + # if ((builtins.match "^refs/heads/(.*)$" ref) == null) then + # null + # else + # { + # name = builtins.replaceStrings [ "/" ] [ "-" ] "branch-${name}"; + # value = makeJob { + # description = "Branch ${name}"; + # flake = "git+ssh://git@github.com/${repo}?ref=${ref}"; + # }; + # }; # Create a hydra job for a PR jobOfPR = id: info: { name = if info.draft then "draft-${id}" else "pr-${id}"; value = makeJob { description = "PR ${id}: ${info.title}"; - flake = "git+ssh://git@github.com/${info.head.repo.full_name}?ref=${info.head.ref}"; + flake = "git+ssh://gitea@nayeonie.com:2222/${info.head.repo.full_name}?ref=${info.head.ref}"; }; }; @@ -74,12 +73,12 @@ let # 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: (x != null)) (map f l); + # mapFilter = f: l: builtins.filter (x: (x != null)) (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)) + # // builtins.listToAttrs (mapFilter ({ name, value }: jobOfRef name value) (attrsToList refs)) ); in { diff --git a/hydra/spec.json b/hydra/spec.json index 820f346..9cfbea1 100644 --- a/hydra/spec.json +++ b/hydra/spec.json @@ -1,7 +1,7 @@ { "enabled": 1, "hidden": false, - "description": "RAD Development infrastructure", + "description": "ahuston-0's personal server infra", "nixexprinput": "nixexpr", "nixexprpath": "hydra/jobsets.nix", "checkinterval": 60, @@ -12,7 +12,7 @@ "type": 0, "inputs": { "nixexpr": { - "value": "https://github.com/RAD-Development/nix-dotfiles main", + "value": "ssh://gitea@nayeonie.com:2222/ahuston-0/nix-dotfiles.git main", "type": "git", "emailresponsible": false }, @@ -22,13 +22,8 @@ "emailresponsible": false }, "pulls": { - "type": "githubpulls", - "value": "RAD-Development nix-dotfiles", - "emailresponsible": false - }, - "branches": { - "type": "github_refs", - "value": "RAD-Development nix-dotfiles heads -", + "type": "giteapulls", + "value": "nayeonie.com alice nix-dotfiles https", "emailresponsible": false } } diff --git a/systems/palatine-hill/configuration.nix b/systems/palatine-hill/configuration.nix index bd0ecc0..4281bd6 100644 --- a/systems/palatine-hill/configuration.nix +++ b/systems/palatine-hill/configuration.nix @@ -13,13 +13,12 @@ ./firewall.nix ./haproxy ./hardware-changes.nix - # ./hydra.nix + ./hydra.nix ./minio.nix ./networking.nix ./nextcloud.nix ./postgresql.nix ./samba.nix - ./typhon.nix ./zfs.nix ]; diff --git a/systems/palatine-hill/default.nix b/systems/palatine-hill/default.nix index 72ac4f7..d469ee0 100644 --- a/systems/palatine-hill/default.nix +++ b/systems/palatine-hill/default.nix @@ -3,6 +3,5 @@ users = [ "alice" ]; modules = [ # inputs.attic.nixosModules.atticd - inputs.typhon.nixosModules.default ]; } diff --git a/systems/palatine-hill/hydra.nix b/systems/palatine-hill/hydra.nix index 7ad5635..43cabe8 100644 --- a/systems/palatine-hill/hydra.nix +++ b/systems/palatine-hill/hydra.nix @@ -1,7 +1,6 @@ { config, - lib, - pkgs, + inputs, ... }: let @@ -43,6 +42,7 @@ in services = { hydra = { enable = true; + package = inputs.hydra.packages.hydra; hydraURL = "https://hydra.alicehuston.xyz"; smtpHost = "alicehuston.xyz"; notificationSender = "hydra@alicehuston.xyz"; diff --git a/systems/palatine-hill/vars.nix b/systems/palatine-hill/vars.nix index ed72ea0..9b06ade 100644 --- a/systems/palatine-hill/vars.nix +++ b/systems/palatine-hill/vars.nix @@ -17,5 +17,4 @@ rec { primary_nextcloud = "${zfs_primary}/nextcloud"; primary_redis = "${zfs_primary}/redis"; primary_torr = "${zfs_primary}/torr"; - primary_typhon = "${zfs_primary}/typhon"; }