infra/hosts/web01/lemmy.nix

46 lines
1.1 KiB
Nix
Raw Normal View History

2023-07-15 17:32:56 +12:00
{ pkgs, config, ... }:
2023-07-06 02:48:33 +12:00
let
domain = "lemmy.nix-community.org";
in
{
2023-07-13 16:06:00 +12:00
sops.secrets.pictrs-env = { };
sops.secrets.lemmy-pictrsapikeyfile = { };
2023-07-13 16:06:00 +12:00
2023-07-06 02:48:33 +12:00
services.lemmy = {
enable = true;
nginx.enable = true;
database.createLocally = true;
pictrsApiKeyFile = config.sops.secrets.lemmy-pictrsapikeyfile.path;
2023-07-06 02:48:33 +12:00
settings = {
hostname = domain;
2023-07-13 16:06:00 +12:00
pictrs = {
url = with config.services.pict-rs; "http://${address}:${toString port}";
};
2023-07-06 02:48:33 +12:00
};
};
systemd.services.lemmy.unitConfig.Upholds = [ "pict-rs.service" ];
2023-07-06 02:48:33 +12:00
services.nginx.virtualHosts.${domain} = {
enableACME = true;
forceSSL = true;
};
# Lemmy image storage
services.pict-rs = {
enable = true;
2023-07-15 17:32:56 +12:00
package = pkgs.pict-rs; # Use 0.4.0+ despite stateVersion
storePath = "/mnt/lemmy-pict-rs";
repoPath = "/var/lib/pict-rs/sled";
2023-07-06 02:48:33 +12:00
};
2023-07-15 17:32:56 +12:00
systemd.services.pict-rs.unitConfig.RequiresMountsFor = [ "/mnt/lemmy-pict-rs" ];
2023-07-13 16:06:00 +12:00
systemd.services.pict-rs.serviceConfig.EnvironmentFile = [
config.sops.secrets.pictrs-env.path
];
2023-07-06 02:48:33 +12:00
# Pict-rs uses DynamicUser
systemd.services.pict-rs.serviceConfig.ReadWritePaths = "/mnt/lemmy-pict-rs";
}