Store names of vendors only once

This commit is contained in:
Manuel Thalmann 2024-05-16 00:38:44 +02:00
parent f61258a6ae
commit 562bcc0574

View file

@ -2,6 +2,9 @@
let let
cfg = config.programs.rclone; cfg = config.programs.rclone;
targetName = "rclone"; targetName = "rclone";
owncloudVendor = "owncloud";
owncloudName = "Owncloud";
nextcloudVendor = "nextcloud";
mkIfNotNull = value: result: lib.mkIf (value != null) result; mkIfNotNull = value: result: lib.mkIf (value != null) result;
mkSystemdDependencyOption = mkSystemdDependencyOption =
@ -129,9 +132,7 @@ let
}; };
})); }));
owncloudName = "Owncloud"; mkOwncloudProvider = { displayName ? owncloudName, vendor ? owncloudVendor }: (
mkOwncloudProvider = { displayName ? owncloudName, vendor ? "owncloud" }: (
{ config, ... }: { { config, ... }: {
imports = [ imports = [
(mkWebdavProvider { inherit displayName vendor; }) (mkWebdavProvider { inherit displayName vendor; })
@ -150,16 +151,16 @@ let
}); });
syncProviders = { syncProviders = {
nextcloud = rec { ${nextcloudVendor} = rec {
displayName = "Nextcloud"; displayName = "Nextcloud";
module = mkOwncloudProvider { module = mkOwncloudProvider {
inherit displayName; inherit displayName;
vendor = "nextcloud"; vendor = nextcloudVendor;
}; };
}; };
owncloud = { ${owncloudVendor} = {
displayName = owncloudName; displayName = owncloudName;
module = mkOwncloudProvider { }; module = mkOwncloudProvider { };
}; };