mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-17 18:34:38 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
102 lines
2.5 KiB
Nix
102 lines
2.5 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
utils,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.services.flood;
|
|
in
|
|
{
|
|
meta.maintainers = with lib.maintainers; [ thiagokokada ];
|
|
|
|
options.services.flood = {
|
|
enable = lib.mkEnableOption "flood";
|
|
package = lib.mkPackageOption pkgs "flood" { };
|
|
openFirewall = lib.mkEnableOption "" // {
|
|
description = "Whether to open the firewall for the port in {option}`services.flood.port`.";
|
|
};
|
|
port = lib.mkOption {
|
|
type = lib.types.int;
|
|
description = "Port to bind webserver.";
|
|
default = 3000;
|
|
example = 3001;
|
|
};
|
|
host = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "Host to bind webserver.";
|
|
default = "localhost";
|
|
example = "::";
|
|
};
|
|
extraArgs = lib.mkOption {
|
|
type = with lib.types; listOf str;
|
|
description = "Extra arguments passed to `flood`.";
|
|
default = [ ];
|
|
example = [ "--baseuri=/" ];
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
systemd.services.flood = {
|
|
description = "A modern web UI for various torrent clients.";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
unitConfig = {
|
|
Documentation = "https://github.com/jesec/flood/wiki";
|
|
};
|
|
serviceConfig = {
|
|
Restart = "on-failure";
|
|
RestartSec = "3s";
|
|
ExecStart = utils.escapeSystemdExecArgs (
|
|
[
|
|
(lib.getExe cfg.package)
|
|
"--host"
|
|
cfg.host
|
|
"--port"
|
|
(toString cfg.port)
|
|
"--rundir=/var/lib/flood"
|
|
]
|
|
++ cfg.extraArgs
|
|
);
|
|
|
|
CapabilityBoundingSet = [ "" ];
|
|
DynamicUser = true;
|
|
LockPersonality = true;
|
|
NoNewPrivileges = true;
|
|
PrivateDevices = true;
|
|
PrivateTmp = true;
|
|
ProtectClock = true;
|
|
ProtectControlGroups = true;
|
|
ProtectHome = true;
|
|
ProtectHostname = true;
|
|
ProtectKernelLogs = true;
|
|
ProtectKernelModules = true;
|
|
ProtectKernelTunables = true;
|
|
ProtectProc = "invisible";
|
|
ProtectSystem = "strict";
|
|
RestrictAddressFamilies = [
|
|
"AF_UNIX"
|
|
"AF_INET"
|
|
"AF_INET6"
|
|
];
|
|
RestrictNamespaces = true;
|
|
RestrictRealtime = true;
|
|
RestrictSUIDSGID = true;
|
|
StateDirectory = "flood";
|
|
SystemCallArchitectures = "native";
|
|
SystemCallFilter = [
|
|
"@system-service"
|
|
"@pkey"
|
|
"~@privileged"
|
|
];
|
|
};
|
|
};
|
|
|
|
networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [
|
|
cfg.port
|
|
];
|
|
};
|
|
}
|