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
{ tgcMaintainers, tgcFlake, ... }:
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) types;
cfg = config.tgc.services.gomuks-web;
in
{
meta.maintainers = [ tgcMaintainers.zaphyra ];
options.tgc.services.gomuks-web = {
enable = lib.mkEnableOption "A Matrix client written in Go.";
package = lib.mkPackageOption tgcFlake.packages.${pkgs.system} "gomuks-web" { };
listenAddress = lib.mkOption {
type = types.str;
default = "localhost:29325";
description = "Address to listen on.";
};
disableAuth = lib.mkOption {
type = types.bool;
default = false;
description = "Disable the basic-auth required to acces the web-interface.";
};
};
config = lib.mkIf cfg.enable {
systemd.user.services.gomuks-web = {
Unit = {
Description = "A Matrix client written in Go.";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Restart = "on-failure";
RestartSec = 5;
ExecStartPre = pkgs.writeShellScript "gomuks-web-start-pre" ''
if [ -f ${config.xdg.configHome}/gomuks/config.yaml ]; then
${lib.getExe pkgs.yq-go} -i '.web.listen_address = "${cfg.listenAddress}"' ${config.xdg.configHome}/gomuks/config.yaml
fi
'';
ExecStart = lib.concatStringsSep "" [
(lib.getExe cfg.package)
(if cfg.disableAuth then " --disable-auth" else "")
];
};
Install.WantedBy = [ "graphical-session.target" ];
};
};
}