From 700475f2195fcbd83518e8f668d997641480f66f Mon Sep 17 00:00:00 2001 From: Joseph Hanson Date: Sat, 13 Jul 2024 08:56:23 -0500 Subject: [PATCH] Added sanoid module. --- nixos/modules/nixos/services/default.nix | 1 + .../modules/nixos/services/sanoid/default.nix | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 nixos/modules/nixos/services/sanoid/default.nix diff --git a/nixos/modules/nixos/services/default.nix b/nixos/modules/nixos/services/default.nix index ad07e7d..48dd264 100644 --- a/nixos/modules/nixos/services/default.nix +++ b/nixos/modules/nixos/services/default.nix @@ -11,5 +11,6 @@ ./radicale ./reboot-required-check.nix ./restic + ./sanoid ]; } diff --git a/nixos/modules/nixos/services/sanoid/default.nix b/nixos/modules/nixos/services/sanoid/default.nix new file mode 100644 index 0000000..1d41ec2 --- /dev/null +++ b/nixos/modules/nixos/services/sanoid/default.nix @@ -0,0 +1,25 @@ +{ lib, config, pkgs, ... }: +with lib; +let + cfg = config.mySystem.services.sanoid; +in +{ + options.mySystem.services.sanoid = { + enable = mkEnableOption "sanoid"; + package = mkPackageOption pkgs "sanoid" { }; + datasets = mkOption { + type = lib.types.attrsOf (lib.types.attrsOf lib.types.unspecified); + }; + templates = mkOption { + type = lib.types.attrsOf (lib.types.attrsOf lib.types.unspecified); + }; + }; + + config = mkIf cfg.enable { + # Enable sanoid with the given templates and datasets + services.sanoid = { + enable = true; + inherit (cfg) package datasets templates; + }; + }; +}