-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.nix
More file actions
58 lines (51 loc) · 1.7 KB
/
module.nix
File metadata and controls
58 lines (51 loc) · 1.7 KB
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
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.remote-text-server;
in
{
options.services.remote-text-server = {
enable = mkEnableOption "remote-text-server";
package = mkOption {
default = pkgs.callPackage ./. { texlive = pkgs.texliveFull; };
defaultText = "remote-text-server";
example = "inputs.remote-text-server.packages.${pkgs.system}.default.override { texlive = pkgs.texliveMinimal; }";
description = "The remote-text-server package to use";
type = types.package;
};
port = mkOption {
type = types.port;
default = 7870;
example = 46264;
description = "The port to listen on. Currently ignored and always uses 3030";
};
};
config = mkIf cfg.enable {
systemd.services.remote-text-server = {
description = "RemoteText Server";
script = ''
cd $STATE_DIRECTORY
${cfg.package}/bin/remote-text-server --port ${toString cfg.port}
'';
serviceConfig = {
DynamicUser = true;
# EnvironmentFile = "/etc/jekyll-comments-env";
StateDirectory = "remote-text-server";
PrivateDevices = true;
PrivateMounts = true;
PrivateUsers = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
};
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
};
# unnecessary bc tailscale is open. also should be set by the end user
# networking.firewall.interfaces."tailscale0".allowedTCPPorts = [ cfg.port ];
};
}