1 { config, lib, pkgs, ... }:
7 cfg = config.services.tiddlywiki;
8 listenParams = concatStrings (mapAttrsToList (n: v: " '${n}=${toString v}' ") cfg.listenOptions);
9 exe = "${pkgs.nodePackages.tiddlywiki}/lib/node_modules/.bin/tiddlywiki";
11 dataDir = "/var/lib/" + name;
15 options.services.tiddlywiki = {
17 enable = mkEnableOption "TiddlyWiki nodejs server";
19 listenOptions = mkOption {
23 credentials = "../credentials.csv";
24 readers="(authenticated)";
28 Parameters passed to `--listen` command.
29 Refer to <https://tiddlywiki.com/#WebServer>
30 for details on supported values.
35 config = mkIf cfg.enable {
37 services.tiddlywiki = {
38 description = "TiddlyWiki nodejs server";
39 after = [ "network.target" ];
40 wantedBy = [ "multi-user.target" ];
43 Restart = "on-failure";
45 StateDirectory = name;
46 ExecStartPre = "-${exe} ${dataDir} --init server";
47 ExecStart = "${exe} ${dataDir} --listen ${listenParams}";