1 { config, lib, pkgs, ... }:
4 cfg = config.services.tiddlywiki;
5 listenParams = lib.concatStrings (lib.mapAttrsToList (n: v: " '${n}=${toString v}' ") cfg.listenOptions);
6 exe = "${pkgs.nodePackages.tiddlywiki}/lib/node_modules/.bin/tiddlywiki";
8 dataDir = "/var/lib/" + name;
12 options.services.tiddlywiki = {
14 enable = lib.mkEnableOption "TiddlyWiki nodejs server";
16 listenOptions = lib.mkOption {
17 type = lib.types.attrs;
20 credentials = "../credentials.csv";
21 readers="(authenticated)";
25 Parameters passed to `--listen` command.
26 Refer to <https://tiddlywiki.com/#WebServer>
27 for details on supported values.
32 config = lib.mkIf cfg.enable {
34 services.tiddlywiki = {
35 description = "TiddlyWiki nodejs server";
36 after = [ "network.target" ];
37 wantedBy = [ "multi-user.target" ];
40 Restart = "on-failure";
42 StateDirectory = name;
43 ExecStartPre = "-${exe} ${dataDir} --init server";
44 ExecStart = "${exe} ${dataDir} --listen ${listenParams}";