Generate a config file for the use with rclone

This commit is contained in:
Manuel Thalmann 2024-05-15 21:10:35 +02:00
parent 824bcbfbe5
commit 5e7d685d60

View file

@ -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