2024-08-23 16:48:30 +00:00
|
|
|
{ lib, ... }:
|
2024-10-06 19:25:34 +00:00
|
|
|
let
|
2024-10-13 18:14:54 +00:00
|
|
|
inherit (lib) mkEnableOption mkOption types;
|
2024-08-23 16:48:30 +00:00
|
|
|
|
2024-10-06 19:25:34 +00:00
|
|
|
syncType = types.submodule (
|
|
|
|
{ ... }: {
|
|
|
|
options = {
|
|
|
|
dirName = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = "The name of the directory to sync the remote files to.";
|
|
|
|
};
|
2024-08-23 16:48:30 +00:00
|
|
|
|
2024-10-06 19:25:34 +00:00
|
|
|
cacheDuration = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
2024-10-13 18:14:54 +00:00
|
|
|
description = "The amount of time to keep files in the cache.";
|
2024-10-06 19:25:34 +00:00
|
|
|
default = null;
|
2024-08-23 16:48:30 +00:00
|
|
|
};
|
2024-10-06 19:25:34 +00:00
|
|
|
};
|
|
|
|
});
|
2024-10-13 18:14:54 +00:00
|
|
|
|
|
|
|
commonOptions = {
|
|
|
|
enable = mkEnableOption "rclone";
|
|
|
|
};
|
|
|
|
|
|
|
|
userOptions = commonOptions // {
|
|
|
|
configurations = mkOption {
|
|
|
|
type = types.attrsOf syncType;
|
|
|
|
description = "The configurations of the rclone mounts.";
|
|
|
|
default = { };
|
|
|
|
};
|
|
|
|
};
|
2024-10-06 19:25:34 +00:00
|
|
|
in {
|
|
|
|
options = {
|
2024-10-13 18:14:54 +00:00
|
|
|
valhalla.linux = {
|
|
|
|
programs.rclone = commonOptions;
|
|
|
|
|
|
|
|
users = mkOption {
|
|
|
|
type = types.attrsOf (types.submodule (
|
|
|
|
{ ... }: {
|
|
|
|
options = {
|
|
|
|
programs.rclone = userOptions;
|
2024-08-23 16:48:30 +00:00
|
|
|
};
|
2024-10-13 18:14:54 +00:00
|
|
|
}));
|
|
|
|
};
|
2024-08-23 16:48:30 +00:00
|
|
|
};
|
2024-10-06 19:25:34 +00:00
|
|
|
};
|
|
|
|
}
|