1
0
Fork 0
nix-configuration/modules/services/rss.nix

70 lines
1.7 KiB
Nix
Raw Normal View History

2024-12-02 19:32:24 +00:00
{
pkgs,
config,
lib,
...
}:
let
cfg = config.aux.system.services.rss;
in
{
options = {
aux.system.services.rss = {
enable = lib.mkEnableOption "Enables RSS hosting service via FreshRSS.";
auth = {
password = lib.mkOption {
default = "";
type = lib.types.str;
description = "The password to use for the default user.";
example = "MySuperSecurePassword123";
};
user = lib.mkOption {
default = "ltuser";
type = lib.types.str;
description = "The username to use for the default user.";
};
};
home = lib.mkOption {
default = "";
type = lib.types.str;
description = "Where to store FreshRSS's files";
example = "/home/freshrss";
};
url = lib.mkOption {
default = "";
type = lib.types.str;
description = "The complete URL where FreshRSS is hosted.";
example = "https://rss.example.com";
};
};
};
config = lib.mkIf cfg.enable {
services = {
freshrss = {
enable = true;
baseUrl = cfg.url;
dataDir = cfg.home;
defaultUser = cfg.auth.user;
passwordFile = pkgs.writeText "rss-defaultpassword" ''
${cfg.auth.password}
'';
authType = "form";
database.type = "sqlite";
virtualHost = cfg.url;
};
nginx.virtualHosts."${cfg.url}" = {
useACMEHost = pkgs.util.getDomainFromURL cfg.url;
forceSSL = true;
};
};
systemd.services = {
freshrss.unitConfig.RequiresMountsFor = cfg.home;
nginx.wants = [ config.systemd.services.freshrss.name ];
};
};
}