1 { config, lib, pkgs, utils, ... }:
4 cfg = config.services.flood;
7 meta.maintainers = with lib.maintainers; [ thiagokokada ];
9 options.services.flood = {
10 enable = lib.mkEnableOption "flood";
11 package = lib.mkPackageOption pkgs "flood" { };
12 openFirewall = lib.mkEnableOption "" // {
13 description = "Whether to open the firewall for the port in {option}`services.flood.port`.";
17 description = "Port to bind webserver.";
23 description = "Host to bind webserver.";
24 default = "localhost";
27 extraArgs = lib.mkOption {
28 type = with lib.types; listOf str;
29 description = "Extra arguments passed to `flood`.";
31 example = [ "--baseuri=/" ];
35 config = lib.mkIf cfg.enable {
36 systemd.services.flood = {
37 description = "A modern web UI for various torrent clients.";
38 after = [ "network.target" ];
39 wantedBy = [ "multi-user.target" ];
41 Documentation = "https://github.com/jesec/flood/wiki";
44 Restart = "on-failure";
46 ExecStart = utils.escapeSystemdExecArgs ([
47 (lib.getExe cfg.package)
52 "--rundir=/var/lib/flood"
55 CapabilityBoundingSet = [ "" ];
57 LockPersonality = true;
58 NoNewPrivileges = true;
59 PrivateDevices = true;
62 ProtectControlGroups = true;
64 ProtectHostname = true;
65 ProtectKernelLogs = true;
66 ProtectKernelModules = true;
67 ProtectKernelTunables = true;
68 ProtectProc = "invisible";
69 ProtectSystem = "strict";
70 RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
71 RestrictNamespaces = true;
72 RestrictRealtime = true;
73 RestrictSUIDSGID = true;
74 StateDirectory = "flood";
75 SystemCallArchitectures = "native";
76 SystemCallFilter = [ "@system-service" "@pkey" "~@privileged" ];
80 networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [