1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00
home-manager/modules/programs/onedrive.nix
Austin Horstman 86402a17b6 treewide: flatten single file modules
Some files don't need nesting and can be root level again to reduce
conflicts with other PRs.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-06-23 16:20:26 -05:00

62 lines
1.4 KiB
Nix

{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkPackageOption
mkOption
types
;
cfg = config.programs.onedrive;
generateConfig = lib.generators.toKeyValue {
mkKeyValue = name: value: ''${name} = "${value}"'';
};
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.programs.onedrive = {
enable = mkEnableOption "onedrive";
package = mkPackageOption pkgs "onedrive" { nullable = true; };
settings = mkOption {
type = with types; attrsOf str;
default = { };
example = ''
{
check_nomount = "false";
check_nosync = "false";
classify_as_big_delete = "1000";
cleanup_local_files = "false";
disable_notifications = "false";
no_remote_delete = "false";
rate_limit = "0";
resync = "false";
skip_dotfiles = "false";
}
'';
description = ''
Configuration settings for Onedrive. All available options can be
found at <https://github.com/abraunegg/onedrive/blob/master/config>.
'';
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "programs.onedrive" pkgs lib.platforms.linux)
];
home.packages = mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = mkIf (cfg.settings != { }) {
"onedrive/config".text = generateConfig cfg.settings;
};
};
}