1 diff --git a/nixos/modules/services/backup/sanoid.nix b/nixos/modules/services/backup/sanoid.nix
2 index 0d8a90e4d6939..a664cb9e5ae7f 100644
3 --- a/nixos/modules/services/backup/sanoid.nix
4 +++ b/nixos/modules/services/backup/sanoid.nix
9 - commonConfig = config: {
11 - hourly = mkDefault config.hourly;
12 - daily = mkDefault config.daily;
13 - monthly = mkDefault config.monthly;
14 - yearly = mkDefault config.yearly;
15 - autoprune = mkDefault config.autoprune;
16 - autosnap = mkDefault config.autosnap;
21 - useTemplate = mkOption {
22 + use_template = mkOption {
23 description = "Names of the templates to use for this dataset.";
24 type = (types.listOf (types.enum (attrNames cfg.templates))) // {
25 description = "list of template names";
26 @@ -84,20 +73,17 @@ let
30 - processChildrenOnly = mkOption {
31 + process_children_only = mkOption {
32 description = "Whether to only snapshot child datasets if recursing.";
38 - datasetConfig = config: {
40 - use_template = mkDefault config.useTemplate;
41 - recursive = mkDefault config.recursive;
42 - process_children_only = mkDefault config.processChildrenOnly;
45 + mkDefaultSettings = config:
46 + mapAttrs (n: mkDefault)
47 + (filterAttrs (n: v: n!="settings" && !hasPrefix "_" n)
50 # Extract pool names from configured datasets
51 pools = unique (map (d: head (builtins.match "([^/]+).*" d)) (attrNames cfg.datasets));
52 @@ -136,7 +122,7 @@ in {
54 type = types.attrsOf (types.submodule ({ config, ... }: {
55 options = commonOptions // datasetOptions;
56 - config = mkMerge [ (commonConfig config) (datasetConfig config) ];
57 + config.settings = mkDefaultSettings config;
60 description = "Datasets to snapshot.";
61 @@ -145,7 +131,7 @@ in {
62 templates = mkOption {
63 type = types.attrsOf (types.submodule ({ config, ... }: {
64 options = commonOptions;
65 - config = commonConfig config;
66 + config.settings = mkDefaultSettings config;
69 description = "Templates for datasets.";
70 diff --git a/nixos/tests/sanoid.nix b/nixos/tests/sanoid.nix
71 index 66ddaad60ea25..710ad76031679 100644
72 --- a/nixos/tests/sanoid.nix
73 +++ b/nixos/tests/sanoid.nix
74 @@ -33,7 +33,7 @@ in {
78 - datasets."pool/test".useTemplate = [ "test" ];
79 + datasets."pool/test".use_template = [ "test" ];