1 { config, lib, pkgs, ... }:
6 cfg = config.services.prosody-filer;
8 settingsFormat = pkgs.formats.toml { };
9 configFile = settingsFormat.generate "prosody-filer.toml" cfg.settings;
13 services.prosody-filer = {
14 enable = mkEnableOption "Prosody Filer XMPP upload file server";
18 Configuration for Prosody Filer.
19 Refer to <https://github.com/ThomasLeister/prosody-filer#configure-prosody-filer> for details on supported values.
22 type = settingsFormat.type;
26 storeDir = "/srv/http/nginx/prosody-upload";
29 defaultText = literalExpression ''
31 listenport = mkDefault "127.0.0.1:5050";
32 uploadSubDir = mkDefault "upload/";
39 config = mkIf cfg.enable {
40 services.prosody-filer.settings = {
41 listenport = mkDefault "127.0.0.1:5050";
42 uploadSubDir = mkDefault "upload/";
45 users.users.prosody-filer = {
46 group = "prosody-filer";
50 users.groups.prosody-filer = { };
52 systemd.services.prosody-filer = {
53 description = "Prosody file upload server";
54 wantedBy = [ "multi-user.target" ];
55 after = [ "network.target" ];
58 User = "prosody-filer";
59 Group = "prosody-filer";
60 ExecStart = "${pkgs.prosody-filer}/bin/prosody-filer -config ${configFile}";
61 Restart = "on-failure";
62 CapabilityBoundingSet = "";
63 NoNewPrivileges = true;
64 PrivateDevices = true;
69 ProtectProc = "noaccess";
71 ProtectKernelLogs = true;
72 ProtectKernelModules = true;
73 ProtectKernelTunables = true;
74 ProtectControlGroups = true;
75 ProtectHostname = true;
76 RestrictSUIDSGID = true;
77 RestrictRealtime = true;
78 RestrictNamespaces = true;
79 LockPersonality = true;
81 RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
82 SystemCallFilter = [ "@system-service" "~@privileged" ];