diff --git a/services/fediversity/mastodon/options.nix b/services/fediversity/mastodon/options.nix index 16b148d7..841284b0 100644 --- a/services/fediversity/mastodon/options.nix +++ b/services/fediversity/mastodon/options.nix @@ -1,35 +1,14 @@ { config, lib, ... }: -let - inherit (lib) mkOption mkEnableOption; - inherit (lib.types) types; - -in { - options.fediversity.mastodon = { - enable = mkEnableOption "Enable a Mastodon server on the machine"; + options.fediversity.mastodon = + (import ../sharedOptions.nix { + inherit config lib; + serviceName = "mastodon"; + serviceDocName = "Mastodon"; + }) + // - s3AccessKey = mkOption { - type = types.str; - description = '' - S3 access key - - In AWS CLI, this would be AWS_ACCESS_KEY_ID. - ''; + { }; - - s3SecretKey = mkOption { - description = '' - S3 secret key - - In AWS CLI, this would be AWS_SECRET_ACCESS_KEY. - ''; - }; - - domain = mkOption { - type = types.str; - description = "Internal option — change at your own risk"; - default = "mastodon.${config.fediversity.domain}"; - }; - }; } diff --git a/services/fediversity/peertube/options.nix b/services/fediversity/peertube/options.nix index b4864372..21eaa021 100644 --- a/services/fediversity/peertube/options.nix +++ b/services/fediversity/peertube/options.nix @@ -1,45 +1,28 @@ { config, lib, ... }: let - inherit (lib) mkOption mkEnableOption; + inherit (lib) mkOption; inherit (lib.types) types; in { - options.fediversity.peertube = { - enable = mkEnableOption "Enable a PeerTube server on the machine"; + options.fediversity.peertube = + (import ../sharedOptions.nix { + inherit config lib; + serviceName = "peertube"; + serviceDocName = "PeerTube"; + }) + // - s3AccessKey = mkOption { - type = types.str; - description = '' - S3 access key + { + secretsFile = mkOption { + type = types.path; + description = '' + Internal option — change at your own risk - In AWS CLI, this would be AWS_ACCESS_KEY_ID. - ''; + FIXME: should it be provided by NixOps4? + or maybe we should just ask for a main secret from which to derive all the others? + ''; + }; }; - - s3SecretKey = mkOption { - description = '' - S3 secret key - - In AWS CLI, this would be AWS_SECRET_ACCESS_KEY. - ''; - }; - - domain = mkOption { - type = types.str; - description = "Internal option — change at your own risk"; - default = "peertube.${config.fediversity.domain}"; - }; - - secretsFile = mkOption { - type = types.path; - description = '' - Internal option — change at your own risk - - FIXME: should it be provided by NixOps4? - or maybe we should just ask for a main secret from which to derive all the others? - ''; - }; - }; } diff --git a/services/fediversity/pixelfed/options.nix b/services/fediversity/pixelfed/options.nix index 27eff699..4248c019 100644 --- a/services/fediversity/pixelfed/options.nix +++ b/services/fediversity/pixelfed/options.nix @@ -1,35 +1,14 @@ { config, lib, ... }: -let - inherit (lib) mkOption mkEnableOption; - inherit (lib.types) types; - -in { - options.fediversity.pixelfed = { - enable = mkEnableOption "Enable a Pixelfed server on the machine"; + options.fediversity.pixelfed = + (import ../sharedOptions.nix { + inherit config lib; + serviceName = "pixelfed"; + serviceDocName = "Pixelfed"; + }) + // - s3AccessKey = mkOption { - type = types.str; - description = '' - S3 access key - - In AWS CLI, this would be AWS_ACCESS_KEY_ID. - ''; + { }; - - s3SecretKey = mkOption { - description = '' - S3 secret key - - In AWS CLI, this would be AWS_SECRET_ACCESS_KEY. - ''; - }; - - domain = mkOption { - type = types.str; - description = "Internal option — change at your own risk"; - default = "pixelfed.${config.fediversity.domain}"; - }; - }; } diff --git a/services/fediversity/sharedOptions.nix b/services/fediversity/sharedOptions.nix new file mode 100644 index 00000000..0d6317e9 --- /dev/null +++ b/services/fediversity/sharedOptions.nix @@ -0,0 +1,38 @@ +{ + config, + lib, + serviceName, + serviceDocName, +}: + +let + inherit (lib) mkOption mkEnableOption; + inherit (lib.types) types; + +in +{ + enable = mkEnableOption "Enable a ${serviceDocName} server on the machine"; + + s3AccessKey = mkOption { + type = types.str; + description = '' + S3 access key for ${serviceDocName}'s bucket/s + + In AWS CLI, this would be AWS_ACCESS_KEY_ID. + ''; + }; + + s3SecretKey = mkOption { + description = '' + S3 secret key for ${serviceDocName}'s bucket/s + + In AWS CLI, this would be AWS_SECRET_ACCESS_KEY. + ''; + }; + + domain = mkOption { + type = types.str; + description = "Internal option — change at your own risk"; + default = "${serviceName}.${config.fediversity.domain}"; + }; +}