blob: 0b66755c36ee149702a0e16f9b20e1524e9fecd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
{config, lib, pkgs, ...}:
let
cfg = config.wilkuu.services.freshrss;
hostname = config.networking.hostName;
in
{
options.wilkuu.services.freshrss = with lib; {
domain = mkOption {
type = types.str;
default = "rss.${hostname}.local";
example = "rss.wilkuu.xyz";
description = "Domain for http connections.";
};
doACME = mkEnableOption "Enable ACME for fresh-rss here";
enable = mkEnableOption "Enable the fresh-rss service";
dataDir = mkOption {
type = types.path;
description = "Storage localtion for fresh-rss data";
default = "/srv/data/freshrss";
example = "/srv/data/freshrss";
};
};
config = lib.mkIf cfg.enable (let
sopsPath = ../secrets/${hostname}/freshrss.yaml;
secrets = ["admin_password" "db_pass"];
toSops = (sname: "fresh-rss/${sname}");
in {
networking.hosts = {
"127.0.0.1" = [cfg.domain];
};
sops.secrets =
(lib.genAttrs (map toSops secrets)
(name: {
sopsFile = sopsPath;
mode = "0440";
owner = config.services.freshrss.user;
}));
services.nginx.virtualHosts."${cfg.domain}" = {
addSSL = cfg.doACME;
enableACME = cfg.doACME;
};
wilkuu.services.mysql = {
enable = true;
users."freshrss" = {
sopsPlaceholder = config.sops.placeholder."fresh-rss/db_pass";
};
databases."freshrss" = {
enable = true;
allowedUsers = ["freshrss"];
};
};
services.freshrss = {
enable = true;
# api.enable = true;
dataDir = cfg.dataDir;
baseUrl = "https://${cfg.domain}";
extensions = with pkgs.freshrss-extensions; [
youtube
title-wrap
auto-ttl
reading-time
];
passwordFile = config.sops.secrets."fresh-rss/admin_password".path;
virtualHost = cfg.domain;
database = {
passFile = config.sops.secrets."fresh-rss/db_pass".path;
host = "localhost";
port = config.wilkuu.services.mysql.port;
name = "freshrss";
user = "freshrss";
type = "mysql";
};
};
});
}
|