From e42ab1b016c42855d44773b6a2be8aa83d72dfc7 Mon Sep 17 00:00:00 2001
From: zowoq <59103226+zowoq@users.noreply.github.com>
Date: Tue, 8 Aug 2023 08:32:34 +1000
Subject: [PATCH] web01: cachix deploy

---
 dev/effect.nix                | 8 +++++++-
 hosts/web01/configuration.nix | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dev/effect.nix b/dev/effect.nix
index 0efcf90..5282c81 100644
--- a/dev/effect.nix
+++ b/dev/effect.nix
@@ -4,11 +4,17 @@
     withSystem "x86_64-linux" ({ hci-effects, pkgs, self', ... }:
       let
         inherit (config.repo) ref;
-        inherit (hci-effects) mkEffect runIf;
+        inherit (hci-effects) mkEffect runCachixDeploy runIf;
         inherit (pkgs.lib) hasPrefix;
       in
       {
         onPush.default.outputs.effects = {
+          cachix-deploy = runIf (hasPrefix "refs/heads/gh-readonly-queue/master/" ref)
+            (runCachixDeploy {
+              deploy.agents = {
+                web01 = builtins.unsafeDiscardStringContext self.nixosConfigurations.web01.config.system.build.toplevel;
+              };
+            });
           terraform-deploy = runIf (hasPrefix "refs/heads/gh-readonly-queue/master/" ref)
             (mkEffect {
               name = "terraform-deploy";
diff --git a/hosts/web01/configuration.nix b/hosts/web01/configuration.nix
index 703aac4..4f99c7e 100644
--- a/hosts/web01/configuration.nix
+++ b/hosts/web01/configuration.nix
@@ -6,6 +6,7 @@
     inputs.srvos.nixosModules.mixins-nginx
     inputs.srvos.nixosModules.hardware-hetzner-cloud
     inputs.self.nixosModules.common
+    inputs.self.nixosModules.cachix-deploy
     ./samba.nix
     ./postgresql.nix
     ./pgbackrest.nix