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
|
let
|
||||||
inherit (lib) const elem flip genAttrs mapAttrs;
|
inherit (lib) const elem flip genAttrs mapAttrs';
|
||||||
inherit (config) gods defaultEffectSystem systems;
|
inherit (config) gods defaultEffectSystem systems;
|
||||||
inherit (self) nixosConfigurations;
|
inherit (self) nixosConfigurations;
|
||||||
|
|
||||||
|
@ -9,18 +9,20 @@ let
|
||||||
|
|
||||||
withEffectSystem = withSystem defaultEffectSystem;
|
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
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
herculesCI = { config, ... }: {
|
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;
|
inherit (hci-effects) runIf runCachixDeploy;
|
||||||
in runIf (elem config.repo.branch [ "master" "staging" ]) (
|
in runIf (elem config.repo.branch [ "master" "staging" ]) (
|
||||||
runCachixDeploy {
|
runCachixDeploy {
|
||||||
async = true;
|
async = true;
|
||||||
deploy = {
|
deploy = {
|
||||||
agents = callUpon chosenHours;
|
agents = callUpon hour;
|
||||||
rollbackScript = genAttrs systems (flip withSystem ({ pkgs, ... }:
|
rollbackScript = genAttrs systems (flip withSystem ({ pkgs, ... }:
|
||||||
let
|
let
|
||||||
scheduleReboot = pkgs.writeShellScript "schedule-reboot.sh" ''
|
scheduleReboot = pkgs.writeShellScript "schedule-reboot.sh" ''
|
||||||
|
@ -58,5 +60,6 @@ in
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
}) chosenHours;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue