Generate a config file for the use with rclone
This commit is contained in:
parent
824bcbfbe5
commit
5e7d685d60
1 changed files with 15 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
let
|
||||
cfg = config.programs.rclone;
|
||||
targetName = "rclone";
|
||||
mkIfNotNull = value: result: lib.mkIf (value != null) result;
|
||||
|
||||
mkSystemdDependencyOption =
|
||||
{ default, global ? false, ... }: lib.mkOption {
|
||||
|
@ -40,7 +41,7 @@ let
|
|||
};
|
||||
|
||||
mkWebdavProvider = { vendor, vendorName }: (
|
||||
mkProvider {
|
||||
{ providerOptions, ... }@args: mkProvider {
|
||||
displayName = vendorName;
|
||||
|
||||
options = {
|
||||
|
@ -73,7 +74,16 @@ let
|
|||
default = null;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
inherit vendor;
|
||||
url = providerOptions.url;
|
||||
}
|
||||
(mkIfNotNull providerOptions.username { user = providerOptions.username; })
|
||||
(mkIfNotNull providerOptions.obscuredPassword { pass = providerOptions.obscuredPassword; })
|
||||
];
|
||||
} args);
|
||||
|
||||
syncProviders = {
|
||||
nextcloud = mkProvider {};
|
||||
|
@ -205,6 +215,9 @@ in {
|
|||
|
||||
ExecStart =
|
||||
let
|
||||
configFile = pkgs.writeText
|
||||
"${serviceName}.conf"
|
||||
(lib.generators.toINI { } { name = sync.config; });
|
||||
script = pkgs.writeShellScriptBin serviceName ''
|
||||
${sync.secretsScript}
|
||||
bash -c echo hello world
|
||||
|
|
Loading…
Reference in a new issue