]> Git — Sourcephile - julm/julm-nix.git/blob - nixpkgs/patches/sanoid.diff
blender: update to 2.92
[julm/julm-nix.git] / nixpkgs / patches / sanoid.diff
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
5 @@ -58,19 +58,8 @@ let
6 };
7 };
8
9 - commonConfig = config: {
10 - settings = {
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;
17 - };
18 - };
19 -
20 datasetOptions = {
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
27 default = false;
28 };
29
30 - processChildrenOnly = mkOption {
31 + process_children_only = mkOption {
32 description = "Whether to only snapshot child datasets if recursing.";
33 type = types.bool;
34 default = false;
35 };
36 };
37
38 - datasetConfig = config: {
39 - settings = {
40 - use_template = mkDefault config.useTemplate;
41 - recursive = mkDefault config.recursive;
42 - process_children_only = mkDefault config.processChildrenOnly;
43 - };
44 - };
45 + mkDefaultSettings = config:
46 + mapAttrs (n: mkDefault)
47 + (filterAttrs (n: v: n!="settings" && !hasPrefix "_" n)
48 + config);
49
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 {
53 datasets = mkOption {
54 type = types.attrsOf (types.submodule ({ config, ... }: {
55 options = commonOptions // datasetOptions;
56 - config = mkMerge [ (commonConfig config) (datasetConfig config) ];
57 + config.settings = mkDefaultSettings config;
58 }));
59 default = {};
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;
67 }));
68 default = {};
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 {
75
76 autosnap = true;
77 };
78 - datasets."pool/test".useTemplate = [ "test" ];
79 + datasets."pool/test".use_template = [ "test" ];
80 };
81
82 services.syncoid = {