diff options
| author | Izorkin <izorkin@elven.pw> | 2022-05-14 18:12:55 +0300 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2022-11-28 11:14:25 +0000 |
| commit | c6d0c1446a74b4d115f1894c5355258d3bce4dcb (patch) | |
| tree | ab006d0a16649b97ee90531975b829025b30af75 | |
| parent | tagainijisho: 1.2.1 -> 1.2.2 (diff) | |
| download | nixpkgs-origin/backport-202398-to-release-22.11.tar.gz | |
nixos/mastodon: add smtp assertionsorigin/backport-202398-to-release-22.11
(cherry picked from commit a02b19fe2b6ff10337a2be0fb8bc907abad08eb7)
| -rw-r--r-- | nixos/modules/services/web-apps/mastodon.nix | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/nixos/modules/services/web-apps/mastodon.nix b/nixos/modules/services/web-apps/mastodon.nix index 1e9e04dcc055..c3220a03d33f 100644 --- a/nixos/modules/services/web-apps/mastodon.nix +++ b/nixos/modules/services/web-apps/mastodon.nix @@ -372,17 +372,19 @@ in { }; user = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + example = "mastodon@example.com"; description = lib.mdDoc "SMTP login name."; - type = lib.types.str; }; passwordFile = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + example = "/var/lib/mastodon/secrets/smtp-password"; description = lib.mdDoc '' Path to file containing the SMTP password. ''; - default = "/var/lib/mastodon/secrets/smtp-password"; - example = "/run/keys/mastodon-smtp-password"; - type = lib.types.str; }; }; @@ -467,6 +469,20 @@ in { assertion = databaseActuallyCreateLocally -> (cfg.user == cfg.database.user); message = ''For local automatic database provisioning (services.mastodon.database.createLocally == true) with peer authentication (services.mastodon.database.host == "/run/postgresql") to work services.mastodon.user and services.mastodon.database.user must be identical.''; } + { + assertion = cfg.smtp.authenticate -> (cfg.smtp.user != null); + message = '' + <option>services.mastodon.smtp.user</option> needs to be set if + <option>services.mastodon.smtp.authenticate</option> is enabled. + ''; + } + { + assertion = cfg.smtp.authenticate -> (cfg.smtp.passwordFile != null); + message = '' + <option>services.mastodon.smtp.passwordFile</option> needs to be set if + <option>services.mastodon.smtp.authenticate</option> is enabled. + ''; + } ]; systemd.services.mastodon-init-dirs = { |
