{lib, ...}: let folderType = lib.types.submodule ({name, ...}: { options = { id = lib.mkOption { type = lib.types.str; }; label = lib.mkOption { type = lib.types.str; default = name; }; }; }); in { folders = lib.mkOption { type = lib.types.attrsOf folderType; default = {}; }; devices = lib.mkOption { type = lib.types.attrsOf (lib.types.submodule ({name, ...}: { options = { name = lib.mkOption { type = lib.types.str; default = name; }; id = lib.mkOption { type = lib.types.str; }; folders = lib.mkOption { type = lib.types.attrsOf (lib.types.submodule ( {config, ...}: { options = { folder = lib.mkOption { type = folderType; }; path = lib.mkOption { type = lib.types.str; }; type = lib.mkOption { type = lib.types.enum ["sendreceive" "sendonly" "receiveonly" "receiveencrypted"]; default = "sendreceive"; }; versioning = { simple = { enable = lib.mkEnableOption "should this folder use simple versioning"; keep = lib.mkOption { type = lib.types.str; default = "10"; }; }; trashcan = { enable = lib.mkEnableOption "should this folder use trashcan versioning"; cleanoutDays = lib.mkOption { type = lib.types.str; default = "1000"; }; }; staggered = { enable = lib.mkEnableOption "should this folder use staggard versioning"; cleanInterval = lib.mkOption { type = lib.types.str; default = "3600"; }; maxAge = lib.mkOption { type = lib.types.str; default = "31536000"; }; }; external = { enable = lib.mkEnableOption "should this folder use external versioning"; }; }; }; # TODO: figure out how to make assertions for submodules # config = { # assertions = # (lib.lists.optionals config.versioning.simple.enable [ # { # assertion = !config.versioning.trashcan.enable; # message = "Can not use both simple and trashcan versioning at the same time."; # } # { # assertion = !config.versioning.staggered.enable; # message = "Can not use both simple and staggered versioning at the same time."; # } # { # assertion = !config.versioning.external.enable; # message = "Can not use both simple and external versioning at the same time."; # } # ]) # ++ (lib.lists.optionals config.versioning.trashcan.enable [ # { # assertion = !config.versioning.staggered.enable; # message = "Can not use both trashcan and staggered versioning at the same time."; # } # { # assertion = !config.versioning.external.enable; # message = "Can not use both trashcan and external versioning at the same time."; # } # ]) # ++ (lib.lists.optionals config.versioning.staggered.enable [ # { # assertion = !config.versioning.external.enable; # message = "Can not use both staggered and external versioning at the same time."; # } # ]) # ++ [ # { # assertion = !config.versioning.external.enable; # message = "External versioning currently not implemented."; # } # ]; # }; } )); }; }; })); default = {}; }; }