1 { config, lib, pkgs, ... }:
5 cfg = config.services.signald;
6 dataDir = "/var/lib/signald";
7 defaultUser = "signald";
10 options.services.signald = {
11 enable = mkEnableOption "signald, the unofficial daemon for interacting with Signal";
15 default = defaultUser;
16 description = "User under which signald runs.";
21 default = defaultUser;
22 description = "Group under which signald runs.";
25 socketPath = mkOption {
27 default = "/run/signald/signald.sock";
28 description = "Path to the signald socket";
32 config = mkIf cfg.enable {
33 users.users = optionalAttrs (cfg.user == defaultUser) {
40 users.groups = optionalAttrs (cfg.group == defaultUser) {
44 systemd.services.signald = {
45 description = "A daemon for interacting with the Signal Private Messenger";
46 wants = [ "network.target" ];
47 wantedBy = [ "multi-user.target" ];
48 after = [ "network.target" ];
53 ExecStart = "${pkgs.signald}/bin/signald -d ${dataDir} -s ${cfg.socketPath}";
54 Restart = "on-failure";
55 StateDirectory = "signald";
56 RuntimeDirectory = "signald";
57 StateDirectoryMode = "0750";
58 RuntimeDirectoryMode = "0750";
67 CapabilityBoundingSet = "";
68 # ProtectClock= adds DeviceAllow=char-rtc r
70 # Use a static user so other applications can access the files
72 LockPersonality = true;
74 #MemoryDenyWriteExecute = true;
75 NoNewPrivileges = true;
76 PrivateDevices = true;
78 # Needs network access
79 #PrivateNetwork = true;
85 ProtectHostname = true;
86 # Would re-mount paths ignored by temporary root
87 #ProtectSystem = "strict";
88 ProtectControlGroups = true;
89 ProtectKernelLogs = true;
90 ProtectKernelModules = true;
91 ProtectKernelTunables = true;
92 ProtectProc = "invisible";
93 RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
94 RestrictNamespaces = true;
95 RestrictRealtime = true;
96 RestrictSUIDSGID = true;
97 SystemCallArchitectures = "native";
98 SystemCallFilter = [ "@system-service" "~@privileged @resources @setuid @keyring" ];
99 TemporaryFileSystem = "/:ro";
100 # Does not work well with the temporary root