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

71 lines
1.7 KiB
Nix
Raw Permalink Normal View History

2024-12-02 19:32:24 +00:00
{
pkgs,
config,
lib,
2024-12-06 18:04:47 +00:00
namespace,
2024-12-02 19:32:24 +00:00
...
}:
let
2024-12-06 18:04:47 +00:00
cfg = config.${namespace}.services.rss;
2024-12-02 19:32:24 +00:00
in
{
options = {
2024-12-06 18:04:47 +00:00
${namespace}.services.rss = {
2024-12-02 19:32:24 +00:00
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;
2024-12-02 19:45:04 +00:00
baseUrl = "https://${cfg.url}";
2024-12-02 19:32:24 +00:00
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 = lib.${namespace}.getDomainFromURI cfg.url;
2024-12-02 19:32:24 +00:00
forceSSL = true;
};
};
systemd.services = {
freshrss.unitConfig.RequiresMountsFor = cfg.home;
nginx.wants = [ config.systemd.services.freshrss.name ];
};
};
}