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
|
let
|
||||||
cfg = config.programs.rclone;
|
cfg = config.programs.rclone;
|
||||||
targetName = "rclone";
|
targetName = "rclone";
|
||||||
|
mkIfNotNull = value: result: lib.mkIf (value != null) result;
|
||||||
|
|
||||||
mkSystemdDependencyOption =
|
mkSystemdDependencyOption =
|
||||||
{ default, global ? false, ... }: lib.mkOption {
|
{ default, global ? false, ... }: lib.mkOption {
|
||||||
|
@ -40,7 +41,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
mkWebdavProvider = { vendor, vendorName }: (
|
mkWebdavProvider = { vendor, vendorName }: (
|
||||||
mkProvider {
|
{ providerOptions, ... }@args: mkProvider {
|
||||||
displayName = vendorName;
|
displayName = vendorName;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
@ -73,7 +74,16 @@ let
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
config = lib.mkMerge [
|
||||||
|
{
|
||||||
|
inherit vendor;
|
||||||
|
url = providerOptions.url;
|
||||||
|
}
|
||||||
|
(mkIfNotNull providerOptions.username { user = providerOptions.username; })
|
||||||
|
(mkIfNotNull providerOptions.obscuredPassword { pass = providerOptions.obscuredPassword; })
|
||||||
|
];
|
||||||
|
} args);
|
||||||
|
|
||||||
syncProviders = {
|
syncProviders = {
|
||||||
nextcloud = mkProvider {};
|
nextcloud = mkProvider {};
|
||||||
|
@ -205,6 +215,9 @@ in {
|
||||||
|
|
||||||
ExecStart =
|
ExecStart =
|
||||||
let
|
let
|
||||||
|
configFile = pkgs.writeText
|
||||||
|
"${serviceName}.conf"
|
||||||
|
(lib.generators.toINI { } { name = sync.config; });
|
||||||
script = pkgs.writeShellScriptBin serviceName ''
|
script = pkgs.writeShellScriptBin serviceName ''
|
||||||
${sync.secretsScript}
|
${sync.secretsScript}
|
||||||
bash -c echo hello world
|
bash -c echo hello world
|
||||||
|
|
Loading…
Reference in a new issue