forked from
tangled.org/core
Monorepo for Tangled — https://tangled.org
1{
2 config,
3 lib,
4 ...
5}: let
6 cfg = config.services.tangled-appview;
7in
8 with lib; {
9 options = {
10 services.tangled-appview = {
11 enable = mkOption {
12 type = types.bool;
13 default = false;
14 description = "Enable tangled appview";
15 };
16 package = mkOption {
17 type = types.package;
18 description = "Package to use for the appview";
19 };
20 port = mkOption {
21 type = types.int;
22 default = 3000;
23 description = "Port to run the appview on";
24 };
25 cookie_secret = mkOption {
26 type = types.str;
27 default = "00000000000000000000000000000000";
28 description = "Cookie secret";
29 };
30 };
31 };
32
33 config = mkIf cfg.enable {
34 systemd.services.tangled-appview = {
35 description = "tangled appview service";
36 wantedBy = ["multi-user.target"];
37
38 serviceConfig = {
39 ListenStream = "0.0.0.0:${toString cfg.port}";
40 ExecStart = "${cfg.package}/bin/appview";
41 Restart = "always";
42 };
43
44 environment = {
45 TANGLED_DB_PATH = "appview.db";
46 TANGLED_COOKIE_SECRET = cfg.cookie_secret;
47 };
48 };
49 };
50 }