about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-12-15T22·44-0500
committergrfn <grfn@gws.fyi>2021-12-15T23·36+0000
commit0f5cc25697b3d43f64ed2914e186cecee75efce7 (patch)
tree56fc5420794aaca93d6f6b39f3bfd4a7a9672157
parent47f1f3be5f3c8ebaf739339e6121bfa26e951037 (diff)
feat(ops/modules): Add shared module for TVL cache r/3261
Add a shared nixos module for configuring whitby as a binary nix cache,
and refactor tverskoy to use this module.

This is enabled via an option to pave the way for including it as an
import in all depot-generated nixos configs at some point in the future.

Change-Id: I6dcc0e8eb48b1ac34457666dceebeedd5da6c526
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4344
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: grfn <grfn@gws.fyi>
-rw-r--r--ops/modules/tvl-cache.nix19
-rw-r--r--users/tazjin/nixos/tverskoy/default.nix11
2 files changed, 21 insertions, 9 deletions
diff --git a/ops/modules/tvl-cache.nix b/ops/modules/tvl-cache.nix
new file mode 100644
index 000000000000..4d574821df44
--- /dev/null
+++ b/ops/modules/tvl-cache.nix
@@ -0,0 +1,19 @@
+{ config, lib, pkgs, ... }:
+
+{
+  options = {
+    tvl.cache.enable = lib.mkEnableOption "the TVL binary cache";
+  };
+
+  config = lib.mkIf config.tvl.cache.enable {
+    nix = {
+      binaryCachePublicKeys = [
+        "cache.tvl.su:kjc6KOMupXc1vHVufJUoDUYeLzbwSr9abcAKdn/U1Jk="
+      ];
+
+      binaryCaches = [
+        "https://cache.tvl.su"
+      ];
+    };
+  };
+}
diff --git a/users/tazjin/nixos/tverskoy/default.nix b/users/tazjin/nixos/tverskoy/default.nix
index 403e9cd6f27c..45bf8c97124c 100644
--- a/users/tazjin/nixos/tverskoy/default.nix
+++ b/users/tazjin/nixos/tverskoy/default.nix
@@ -19,18 +19,11 @@ in lib.fix(self: {
   imports = [
     "${depot.third_party.impermanence}/nixos.nix"
     "${depot.path + "/ops/modules/automatic-gc.nix"}"
+    "${depot.path + "/ops/modules/tvl-cache.nix"}"
     "${pkgs.home-manager.src}/nixos"
   ];
 
-  nix = {
-    binaryCachePublicKeys = [
-      "cache.tvl.su:kjc6KOMupXc1vHVufJUoDUYeLzbwSr9abcAKdn/U1Jk="
-    ];
-
-    binaryCaches = [
-      "https://cache.tvl.su"
-    ];
-  };
+  tvl.cache.enable = true;
 
   boot = rec {
     initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];