From 4dada30f83b25bf25d5c3d2173651a91cce68c06 Mon Sep 17 00:00:00 2001
From: zowoq <59103226+zowoq@users.noreply.github.com>
Date: Sat, 1 Jul 2023 11:09:37 +1000
Subject: [PATCH] Revert "switch back to post-build-hook"

This reverts commit 94de107c309b3d1b0af304553c7f40c2bd39874c.

watch-store seems to be working again with cachix 1.6
---
 hosts/build03/configuration.nix |  1 +
 modules/nixos/hydra/default.nix | 20 +-------------------
 2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/hosts/build03/configuration.nix b/hosts/build03/configuration.nix
index 2b8eac6..99260f5 100644
--- a/hosts/build03/configuration.nix
+++ b/hosts/build03/configuration.nix
@@ -15,6 +15,7 @@
     inputs.self.nixosModules.common
     inputs.self.nixosModules.hercules-ci
     inputs.self.nixosModules.raid
+    inputs.self.nixosModules.watch-store
     inputs.self.nixosModules.zfs
     inputs.self.nixosModules.remote-builder-build04
     inputs.self.nixosModules.remote-builder-darwin02
diff --git a/modules/nixos/hydra/default.nix b/modules/nixos/hydra/default.nix
index 06878ca..b8b069f 100644
--- a/modules/nixos/hydra/default.nix
+++ b/modules/nixos/hydra/default.nix
@@ -1,20 +1,4 @@
-{ lib, inputs, pkgs, config, ... }:
-let
-  upload-to-cachix = pkgs.writeScriptBin "upload-to-cachix" ''
-    #!/bin/sh
-    set -eu
-    set -f # disable globbing
-
-    # skip push if the declarative job spec
-    OUT_END=$(echo ''${OUT_PATHS: -10})
-    if [ "$OUT_END" == "-spec.json" ]; then
-      exit 0
-    fi
-
-    export HOME=/root
-    exec ${pkgs.cachix}/bin/cachix -c ${config.sops.secrets.nix-community-cachix.path} push nix-community $OUT_PATHS > /tmp/hydra_cachix 2>&1
-  '';
-in
+{ lib, pkgs, config, ... }:
 {
   options.services.hydra = {
     adminPasswordFile = lib.mkOption {
@@ -43,9 +27,7 @@ in
       "https://github.com/nix-community/"
       "https://github.com/NixOS/"
     ];
-    nix.settings.post-build-hook = "${upload-to-cachix}/bin/upload-to-cachix";
 
-    sops.secrets.nix-community-cachix.sopsFile = "${toString inputs.self}/modules/nixos/nix-community-cache/secrets.yaml";
     sops.secrets.id_buildfarm = { };
 
     # delete build logs older than 30 days