about summary refs log tree commit diff
path: root/modules/cachix/default.nix
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2024-01-11 14:41:10 +0900
committersefidel <contact@sefidel.net>2024-01-12 00:18:45 +0900
commit60747923348733085f7c7647ba304e75c096d80d (patch)
tree7915504a0dfacc153a27293b9bc2157dd2abfcd4 /modules/cachix/default.nix
parenta0e13034700e6a697c1adac3050702a1d3ba0ecd (diff)
downloadinfra-60747923348733085f7c7647ba304e75c096d80d.tar.gz
infra-60747923348733085f7c7647ba304e75c096d80d.zip
feat(modules, systems): don't implicitly activate modules
Diffstat (limited to 'modules/cachix/default.nix')
-rw-r--r--modules/cachix/default.nix14
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/cachix/default.nix b/modules/cachix/default.nix
index 9dd55b5..5222457 100644
--- a/modules/cachix/default.nix
+++ b/modules/cachix/default.nix
@@ -1,5 +1,9 @@
 { config, pkgs, lib, ... }:
+
+with lib;
 let
+  cfg = config.modules.cachix;
+
   folder = ./caches;
   toImport = name: value: folder + ("/" + name);
   filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
@@ -7,7 +11,13 @@ let
 in
 {
   inherit imports;
-  nix.settings.substituters = [ "https://cache.nixos.org/" ];
 
-  environment.systemPackages = [ pkgs.cachix ];
+  options.modules.cachix = {
+    enable = mkEnableOption "cachix";
+  };
+
+  config = mkIf cfg.enable {
+    nix.settings.substituters = [ "https://cache.nixos.org/" ];
+    environment.systemPackages = [ pkgs.cachix ];
+  };
 }