hosts: deploy in individual effects
This commit is contained in:
parent
f88749fd95
commit
7fdafae1c2
1 changed files with 49 additions and 46 deletions
|
@ -1,7 +1,7 @@
|
|||
{ config, inputs, lib, self, withSystem, ... }:
|
||||
{ config, lib, self, withSystem, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) const elem flip genAttrs mapAttrs;
|
||||
inherit (lib) const elem flip genAttrs mapAttrs';
|
||||
inherit (config) gods defaultEffectSystem systems;
|
||||
inherit (self) nixosConfigurations;
|
||||
|
||||
|
@ -9,18 +9,20 @@ let
|
|||
|
||||
withEffectSystem = withSystem defaultEffectSystem;
|
||||
|
||||
callUpon = hours: mapAttrs (hour: const nixosConfigurations.${hour}.config.system.build.toplevel) hours;
|
||||
callUpon = hour: { ${hour} = nixosConfigurations.${hour}.config.system.build.toplevel; };
|
||||
in
|
||||
|
||||
{
|
||||
herculesCI = { config, ... }: {
|
||||
onPush.default.outputs.effects.callUponTheHours = withEffectSystem ({ hci-effects, ... }: let
|
||||
onPush.default.outputs.effects = mapAttrs' (hour: const {
|
||||
name = "deploy-${hour}";
|
||||
value = withEffectSystem ({ hci-effects, ... }: let
|
||||
inherit (hci-effects) runIf runCachixDeploy;
|
||||
in runIf (elem config.repo.branch [ "master" "staging" ]) (
|
||||
runCachixDeploy {
|
||||
async = true;
|
||||
deploy = {
|
||||
agents = callUpon chosenHours;
|
||||
agents = callUpon hour;
|
||||
rollbackScript = genAttrs systems (flip withSystem ({ pkgs, ... }:
|
||||
let
|
||||
scheduleReboot = pkgs.writeShellScript "schedule-reboot.sh" ''
|
||||
|
@ -58,5 +60,6 @@ in
|
|||
};
|
||||
}
|
||||
));
|
||||
}) chosenHours;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue