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>

a-kenji 5519e1b8 fdabbea2

Changed files
+5 -22
nixos
modules
services
tests
-3
nixos/modules/services/web-apps/lemmy.md
···
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.
···
hostname = "lemmy.union.rocks";
database.createLocally = true;
};
caddy.enable = true;
}
```
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.
+4 -9
nixos/modules/services/web-apps/lemmy.nix
···
# `pandoc lemmy.md -t docbook --top-level-division=chapter --extract-media=media -f markdown+smart > lemmy.xml`
meta.doc = ./lemmy.xml;
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 {
···
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}";
};
};
···
# `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");
ui = {
port = mkOption {
···
requires = lib.optionals cfg.settings.database.createLocally [ "lemmy-postgresql.service" ];
script = ''
${pkgs.coreutils}/bin/install -m 600 ${settingsFormat.generate "config.hjson" cfg.settings} /run/lemmy/config.hjson
${pkgs.lemmy-server}/bin/lemmy_server
'';
serviceConfig = {
DynamicUser = true;
RuntimeDirectory = "lemmy";
};
};
+1 -6
nixos/modules/services/web-apps/lemmy.xml
···
<para>
the minimum to start lemmy is
</para>
-
<programlisting language="bash">
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
···
<para>
the minimum to start lemmy is
</para>
+
<programlisting language="nix">
services.lemmy = {
enable = true;
settings = {
hostname = &quot;lemmy.union.rocks&quot;;
database.createLocally = true;
};
caddy.enable = true;
}
</programlisting>
<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
-4
nixos/tests/lemmy.nix
···
"${lemmyNodeName}" = {
services.lemmy = {
enable = true;
-
jwtSecretPath = pkgs.writeTextFile {
-
name = "lemmy-secret";
-
text = "very-secret-password123";
-
};
ui.port = uiPort;
settings = {
hostname = "http://${lemmyNodeName}";
···
"${lemmyNodeName}" = {
services.lemmy = {
enable = true;
ui.port = uiPort;
settings = {
hostname = "http://${lemmyNodeName}";