PortValhalla/lib/modules/programs/rclone.nix

47 lines
1 KiB
Nix

{ lib, ... }:
let
inherit (lib) mkEnableOption 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 files in the cache.";
default = null;
};
};
});
commonOptions = {
enable = mkEnableOption "rclone";
};
userOptions = commonOptions // {
configurations = mkOption {
type = types.attrsOf syncType;
description = "The configurations of the rclone mounts.";
default = { };
};
};
in {
options = {
valhalla.linux = {
programs.rclone = commonOptions;
users = mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
options = {
programs.rclone = userOptions;
};
}));
};
};
};
}