nixos/lemmy: remove services.lemmy.jwtSecretPath

Co-authored-by: Ctem <c@ctem.me>
Co-authored-by: Brian Leung <leungbk@posteo.net>
Co-authored-by: Shahar Dawn Or <mightyiampresence@gmail.com>
Co-authored-by: Ilan Joselevich <personal@ilanjoselevich.com>
This commit is contained in:
a-kenji 2022-09-12 10:34:55 +02:00 committed by Yt
parent fdabbea239
commit 5519e1b89b
4 changed files with 5 additions and 22 deletions

View file

@ -13,13 +13,10 @@ services.lemmy = {
hostname = "lemmy.union.rocks";
database.createLocally = true;
};
jwtSecretPath = "/run/secrets/lemmyJwt";
caddy.enable = true;
}
```
(note that you can use something like agenix to get your secret jwt to the specified path)
this will start the backend on port 8536 and the frontend on port 1234.
It will expose your instance with a caddy reverse proxy to the hostname you've provided.
Postgres will be initialized on that same instance automatically.

View file

@ -10,15 +10,14 @@ in
# `pandoc lemmy.md -t docbook --top-level-division=chapter --extract-media=media -f markdown+smart > lemmy.xml`
meta.doc = ./lemmy.xml;
imports = [
(mkRemovedOptionModule [ "services" "lemmy" "jwtSecretPath" ] "As of v0.13.0, Lemmy auto-generates the JWT secret.")
];
options.services.lemmy = {
enable = mkEnableOption (lib.mdDoc "lemmy a federated alternative to reddit in rust");
jwtSecretPath = mkOption {
type = types.path;
description = lib.mdDoc "Path to read the jwt secret from.";
};
ui = {
port = mkOption {
type = types.port;
@ -168,18 +167,14 @@ in
requires = lib.optionals cfg.settings.database.createLocally [ "lemmy-postgresql.service" ];
# script is needed here since loadcredential is not accessible on ExecPreStart
script = ''
${pkgs.coreutils}/bin/install -m 600 ${settingsFormat.generate "config.hjson" cfg.settings} /run/lemmy/config.hjson
jwtSecret="$(< $CREDENTIALS_DIRECTORY/jwt_secret )"
${pkgs.jq}/bin/jq ".jwt_secret = \"$jwtSecret\"" /run/lemmy/config.hjson | ${pkgs.moreutils}/bin/sponge /run/lemmy/config.hjson
${pkgs.lemmy-server}/bin/lemmy_server
'';
serviceConfig = {
DynamicUser = true;
RuntimeDirectory = "lemmy";
LoadCredential = "jwt_secret:${cfg.jwtSecretPath}";
};
};

View file

@ -8,21 +8,16 @@
<para>
the minimum to start lemmy is
</para>
<programlisting language="bash">
<programlisting language="nix">
services.lemmy = {
enable = true;
settings = {
hostname = &quot;lemmy.union.rocks&quot;;
database.createLocally = true;
};
jwtSecretPath = &quot;/run/secrets/lemmyJwt&quot;;
caddy.enable = true;
}
</programlisting>
<para>
(note that you can use something like agenix to get your secret
jwt to the specified path)
</para>
<para>
this will start the backend on port 8536 and the frontend on port
1234. It will expose your instance with a caddy reverse proxy to

View file

@ -14,10 +14,6 @@ in
"${lemmyNodeName}" = {
services.lemmy = {
enable = true;
jwtSecretPath = pkgs.writeTextFile {
name = "lemmy-secret";
text = "very-secret-password123";
};
ui.port = uiPort;
settings = {
hostname = "http://${lemmyNodeName}";