From 9195f02b49e238e6444c3da006f21c489ab5d970 Mon Sep 17 00:00:00 2001 From: Izorkin Date: Tue, 13 Dec 2022 22:07:10 +0300 Subject: [PATCH] nixos/peertube: add secretsFile option --- nixos/modules/services/web-apps/peertube.nix | 21 ++++++++++++++++++++ nixos/tests/web-apps/peertube.nix | 7 +++++++ 2 files changed, 28 insertions(+) diff --git a/nixos/modules/services/web-apps/peertube.nix b/nixos/modules/services/web-apps/peertube.nix index 170bc700f775..c01bfca173a1 100644 --- a/nixos/modules/services/web-apps/peertube.nix +++ b/nixos/modules/services/web-apps/peertube.nix @@ -161,6 +161,18 @@ in { description = lib.mdDoc "Configure nginx as a reverse proxy for peertube."; }; + secrets = { + secretsFile = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + example = "/run/secrets/peertube"; + description = lib.mdDoc '' + Secrets to run PeerTube. + Generate one using `openssl rand -hex 32` + ''; + }; + }; + database = { createLocally = lib.mkOption { type = lib.types.bool; @@ -282,6 +294,11 @@ in { prevent this. ''; } + { assertion = cfg.secrets.secretsFile != null; + message = '' + needs to be set. + ''; + } { assertion = !(cfg.redis.enableUnixSocket && (cfg.redis.host != null || cfg.redis.port != null)); message = '' and redis network connection ( or ) enabled. Disable either of them. @@ -418,6 +435,10 @@ in { #!/bin/sh umask 077 cat > /var/lib/peertube/config/local.yaml <