lol

nixos/sanoid: fix aliased options

Fixes https://github.com/NixOS/nixpkgs/issues/181561

+14 -2
+2 -2
nixos/modules/services/backup/sanoid.nix
··· 130 130 type = types.attrsOf (types.submodule ({ config, options, ... }: { 131 131 freeformType = datasetSettingsType; 132 132 options = commonOptions // datasetOptions; 133 - config.use_template = mkAliasDefinitions (mkDefault options.useTemplate or { }); 134 - config.process_children_only = mkAliasDefinitions (mkDefault options.processChildrenOnly or { }); 133 + config.use_template = modules.mkAliasAndWrapDefsWithPriority id (options.useTemplate or { }); 134 + config.process_children_only = modules.mkAliasAndWrapDefsWithPriority id (options.processChildrenOnly or { }); 135 135 })); 136 136 default = { }; 137 137 description = lib.mdDoc "Datasets to snapshot.";
+12
nixos/tests/sanoid.nix
··· 34 34 autosnap = true; 35 35 }; 36 36 datasets."pool/sanoid".use_template = [ "test" ]; 37 + datasets."pool/compat".useTemplate = [ "test" ]; 37 38 extraArgs = [ "--verbose" ]; 38 39 }; 39 40 ··· 51 52 52 53 # Test pool without parent (regression test for https://github.com/NixOS/nixpkgs/pull/180111) 53 54 "pool".target = "root@target:pool/full-pool"; 55 + 56 + # Test backward compatible options (regression test for https://github.com/NixOS/nixpkgs/issues/181561) 57 + "pool/compat" = { 58 + target = "root@target:pool/compat"; 59 + extraArgs = [ "--no-sync-snap" ]; 60 + }; 54 61 }; 55 62 }; 56 63 }; ··· 70 77 "udevadm settle", 71 78 "zpool create pool -R /mnt /dev/vdb1", 72 79 "zfs create pool/sanoid", 80 + "zfs create pool/compat", 73 81 "zfs create pool/syncoid", 74 82 "udevadm settle", 75 83 ) ··· 94 102 95 103 # Take snapshot with sanoid 96 104 source.succeed("touch /mnt/pool/sanoid/test.txt") 105 + source.succeed("touch /mnt/pool/compat/test.txt") 97 106 source.systemctl("start --wait sanoid.service") 98 107 99 108 assert len(source.succeed("zfs allow pool")) == 0, "Pool shouldn't have delegated permissions set after snapshotting" ··· 110 119 111 120 source.systemctl("start --wait syncoid-pool.service") 112 121 target.succeed("[[ -d /mnt/pool/full-pool/syncoid ]]") 122 + 123 + source.systemctl("start --wait syncoid-pool-compat.service") 124 + target.succeed("cat /mnt/pool/compat/test.txt") 113 125 114 126 assert len(source.succeed("zfs allow pool")) == 0, "Pool shouldn't have delegated permissions set after syncing snapshots" 115 127 assert len(source.succeed("zfs allow pool/sanoid")) == 0, "Sanoid dataset shouldn't have delegated permissions set after syncing snapshots"