diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/flake/ci.nix | 86 | ||||
| -rw-r--r-- | modules/nixos/server/services/hercules.nix | 7 |
2 files changed, 71 insertions, 22 deletions
diff --git a/modules/flake/ci.nix b/modules/flake/ci.nix index 64d4f86..8070d93 100644 --- a/modules/flake/ci.nix +++ b/modules/flake/ci.nix @@ -1,24 +1,76 @@ { + config, + inputs, myLib, self, + withSystem, ... -}: { - flake = { - hydraJobs = let - supportedSystems = [ - "x86_64-linux" - "aarch64-linux" - ]; - in - with (myLib.ci supportedSystems); { - # CA derivations don't work on hydra - #apps = mkCompatibleApps self.apps; - checks = mkCompatible self.checks; - devShells = mkCompatible self.devShells; - formatter = mkCompatibleFormatters self.formatter; - homeConfigurations = mkCompatibleHM self.homeConfigurations; - hosts = mkCompatibleCfg self.nixosConfigurations; - packages = mkCompatiblePkgs self.packages; +}: let + mkUpdateEffect = herculesCI: inputs: pullRequestTitle: let + cfg = config.hercules-ci.flake-update; + in + withSystem cfg.effect.system ({hci-effects, ...}: + hci-effects.flakeUpdate { + gitRemote = herculesCI.config.repo.remoteHttpUrl; + user = "x-access-token"; + autoMergeMethod = "rebase"; + commitSummary = pullRequestTitle; + inherit pullRequestTitle inputs; + inherit (cfg) updateBranch forgeType createPullRequest pullRequestBody; + }); +in { + imports = [ + inputs.hercules-ci-effects.flakeModule + ]; + + herculesCI = {lib, ...} @ herculesCI: let + inherit (lib) mkForce; + ciSystems = [ + "x86_64-linux" + "aarch64-linux" + ]; + in { + inherit ciSystems; + + onPush = { + default = { + outputs = with (myLib.ci ciSystems); + mkForce { + apps = mkCompatibleApps self.apps; + checks = mkCompatible self.checks; + devShells = mkCompatible self.devShells; + formatter = mkCompatibleFormatters self.formatter; + hosts = mkCompatibleCfg' self.nixosConfigurations; + packages = mkCompatibleHM self.homeConfigurations; + }; }; + }; + + onSchedule = let + mkUpdateEffect' = mkUpdateEffect herculesCI; + in { + nixpkgs-update = { + when = { + hour = [0]; + minute = 0; + }; + + outputs = { + effects.nixpkgs-update = mkUpdateEffect' ["nixpkgs" "nixpkgs-stable"] "flake: update nixpkgs inputs"; + }; + }; + + flake-update = mkForce { + when = { + dayOfMonth = [1 8 15 22 29]; + hour = [0]; + minute = 0; + }; + + outputs = { + effects.flake-update = mkUpdateEffect' [] "flake: update all inputs"; + }; + }; + }; }; } diff --git a/modules/nixos/server/services/hercules.nix b/modules/nixos/server/services/hercules.nix index 782e5a8..7b55f6c 100644 --- a/modules/nixos/server/services/hercules.nix +++ b/modules/nixos/server/services/hercules.nix @@ -1,7 +1,7 @@ { config, - hercules-ci-agent, lib, + nixpkgs, pkgs, self, ... @@ -43,13 +43,10 @@ in { // hercArgs; }; - environment.systemPackages = [ - hercules-ci-agent.packages.${pkgs.stdenv.hostPlatform.system}.hercules-ci-cli - ]; - services = { hercules-ci-agent = { enable = true; + package = (import nixpkgs {inherit (pkgs) system;}).hercules-ci-agent; settings = { binaryCachesPath = config.age.secrets.binaryCache.path; clusterJoinTokenPath = config.age.secrets.clusterToken.path; |
