From 2ce4520cd64ba4095f35193e0604eaa4e2ebfd6e Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 23 Jan 2025 21:52:50 -0500 Subject: [PATCH] Make zrepl a conditional install. --- nix/configuration/hosts/neelix/default.nix | 1 + nix/configuration/hosts/odo/default.nix | 1 + nix/configuration/roles/zrepl/default.nix | 75 +++++++++++++--------- 3 files changed, 47 insertions(+), 30 deletions(-) diff --git a/nix/configuration/hosts/neelix/default.nix b/nix/configuration/hosts/neelix/default.nix index 498b6d4..9fdba20 100644 --- a/nix/configuration/hosts/neelix/default.nix +++ b/nix/configuration/hosts/neelix/default.nix @@ -30,4 +30,5 @@ me.kodi.enable = true; me.lvfs.enable = true; me.sound.enable = true; + me.zrepl.enable = true; } diff --git a/nix/configuration/hosts/odo/default.nix b/nix/configuration/hosts/odo/default.nix index 7708d4e..17e9537 100644 --- a/nix/configuration/hosts/odo/default.nix +++ b/nix/configuration/hosts/odo/default.nix @@ -57,4 +57,5 @@ me.vscode.enable = true; me.wasm.enable = true; me.waybar.enable = true; + me.zrepl.enable = true; } diff --git a/nix/configuration/roles/zrepl/default.nix b/nix/configuration/roles/zrepl/default.nix index 3801762..9ed4ff9 100644 --- a/nix/configuration/roles/zrepl/default.nix +++ b/nix/configuration/roles/zrepl/default.nix @@ -8,38 +8,53 @@ { imports = [ ]; - services.zrepl = { - enable = true; - settings = { - jobs = [ - { - name = "snapjob"; - type = "snap"; - filesystems = { - "zroot/linux/nix/persist<" = true; - "zroot/bridge<" = true; - }; - snapshotting = { - type = "periodic"; - interval = "15m"; - prefix = "zrepl_"; - }; - pruning = { - keep = [ + options.me = { + zrepl.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install zrepl."; + }; + }; + + config = lib.mkIf config.me.zrepl.enable ( + lib.mkMerge [ + { + services.zrepl = { + enable = true; + settings = { + jobs = [ { - type = "grid"; - grid = "1x1h(keep=all) | 24x1h | 14x1d"; - regex = "^zrepl_.*"; - } - { - type = "regex"; - negate = true; - regex = "^zrepl_.*"; + name = "snapjob"; + type = "snap"; + filesystems = { + "zroot/linux/nix/persist<" = true; + "zroot/bridge<" = true; + }; + snapshotting = { + type = "periodic"; + interval = "15m"; + prefix = "zrepl_"; + }; + pruning = { + keep = [ + { + type = "grid"; + grid = "1x1h(keep=all) | 24x1h | 14x1d"; + regex = "^zrepl_.*"; + } + { + type = "regex"; + negate = true; + regex = "^zrepl_.*"; + } + ]; + }; } ]; }; - } - ]; - }; - }; + }; + } + ] + ); }