onedrive: add module (#6907)
This commit is contained in:
parent
4d2d322317
commit
2f5819a962
6 changed files with 98 additions and 0 deletions
|
|
@ -208,6 +208,7 @@ let
|
|||
./programs/octant.nix
|
||||
./programs/offlineimap.nix
|
||||
./programs/oh-my-posh.nix
|
||||
./programs/onedrive.nix
|
||||
./programs/onlyoffice.nix
|
||||
./programs/opam.nix
|
||||
./programs/openstackclient.nix
|
||||
|
|
|
|||
64
modules/programs/onedrive.nix
Normal file
64
modules/programs/onedrive.nix
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
types
|
||||
concatStringsSep
|
||||
mapAttrsToList
|
||||
;
|
||||
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -378,6 +378,7 @@ import nmtSrc {
|
|||
./modules/programs/mangohud
|
||||
./modules/programs/ncmpcpp-linux
|
||||
./modules/programs/nh
|
||||
./modules/programs/onedrive
|
||||
./modules/programs/pqiv
|
||||
./modules/programs/rbw
|
||||
./modules/programs/rofi
|
||||
|
|
|
|||
1
tests/modules/programs/onedrive/default.nix
Normal file
1
tests/modules/programs/onedrive/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ onedrive-example-config = ./example-config.nix; }
|
||||
9
tests/modules/programs/onedrive/example-config
Normal file
9
tests/modules/programs/onedrive/example-config
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
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"
|
||||
22
tests/modules/programs/onedrive/example-config.nix
Normal file
22
tests/modules/programs/onedrive/example-config.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
programs.onedrive = {
|
||||
enable = true;
|
||||
settings = {
|
||||
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";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/onedrive/config
|
||||
assertFileContent home-files/.config/onedrive/config \
|
||||
${./example-config}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue