From 6ae1a4a6881c308da99284476b340d297ddeacbc Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 23 Aug 2024 18:48:30 +0200 Subject: [PATCH] Create dedicated `rclone` module --- lib/modules/packages/rclone.nix | 40 +++++++++++++++++++++++++++++++++ lib/modules/users.nix | 24 -------------------- 2 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 lib/modules/packages/rclone.nix diff --git a/lib/modules/packages/rclone.nix b/lib/modules/packages/rclone.nix new file mode 100644 index 00000000..78a02a81 --- /dev/null +++ b/lib/modules/packages/rclone.nix @@ -0,0 +1,40 @@ +{ lib, ... }: + let + inherit (lib) + mkOption + types + ; + + syncType = types.submodule ( + { ... }: { + options = { + dirName = mkOption { + type = types.str; + description = "The name of the directory to sync the remote files to."; + }; + + cacheDuration = mkOption { + type = types.nullOr types.str; + description = "The amount of time to keep cached files."; + default = null; + }; + }; + }); + in { + options = { + valhalla.linux.users = mkOption { + type = types.attrsOf (types.submodule ( + { ... }: { + options = { + rclone = { + configurations = mkOption { + type = types.attrsOf syncType; + description = "The configurations of the rclone mounts."; + default = {}; + }; + }; + }; + })); + }; + }; + } diff --git a/lib/modules/users.nix b/lib/modules/users.nix index f43bbc2c..d969e729 100644 --- a/lib/modules/users.nix +++ b/lib/modules/users.nix @@ -7,22 +7,6 @@ cfg = config.valhalla; capitalize = (import ../text.nix { inherit lib; }).capitalize; - - syncType = types.submodule ( - { ... }: { - options = { - dirName = mkOption { - type = types.str; - description = "The name of the directory to sync the remote files to."; - }; - - cacheDuration = mkOption { - type = types.nullOr types.str; - description = "The amount of time to keep cached files."; - default = null; - }; - }; - }); in { options = { valhalla = { @@ -61,14 +45,6 @@ description = "The default shell of the user."; default = null; }; - - rclone = { - configurations = mkOption { - type = types.attrsOf syncType; - description = "The configurations of the rclone mounts."; - default = {}; - }; - }; }; }); };