infra/hosts/web01/lemmy.nix

48 lines
1.2 KiB
Nix
Raw Normal View History

{ inputs, pkgs, lib, ... }:
2023-07-06 02:48:33 +12:00
let
domain = "lemmy.nix-community.org";
in
{
services.lemmy = {
enable = true;
nginx.enable = true;
database.createLocally = true;
settings = {
hostname = domain;
};
};
services.nginx.virtualHosts.${domain} = {
enableACME = true;
forceSSL = true;
};
# Lemmy image storage
services.pict-rs = {
enable = true;
dataDir = "/mnt/lemmy-pict-rs";
};
# In the transition from 0.3.3 to 0.4 pict-rs breaks it's previous
# conflation of data storage and statate storage.
# 0.4 is still not released but we need this separation already.
# This renames the env vars set by the NixOS module.
#
# Migrate to using upstream NixOS definitions when 0.4 is released.
systemd.services.pict-rs.environment = {
PICTRS__REPO__PATH = "/var/lib/pict-rs/sled";
PICTRS__STORE__PATH = "/mnt/lemmy-pict-rs";
};
systemd.services.pict-rs.serviceConfig.ExecStart = lib.mkForce "${lib.getExe pkgs.pict-rs} run";
nixpkgs.overlays = [
(_final: _prev: {
inherit (inputs.pict-rs.packages.x86_64-linux) pict-rs;
})
];
2023-07-06 02:48:33 +12:00
# Pict-rs uses DynamicUser
systemd.services.pict-rs.serviceConfig.ReadWritePaths = "/mnt/lemmy-pict-rs";
}