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; + }; + }; +}