mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-19 16:40:32 +03:00

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-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev 0128fbb0a5
result/bin/apply-formatting $NIXPKGS_PATH
111 lines
2.8 KiB
Nix
111 lines
2.8 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
with lib;
|
|
let
|
|
cfg = config.services.tang;
|
|
in
|
|
{
|
|
options.services.tang = {
|
|
enable = mkEnableOption "tang";
|
|
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = pkgs.tang;
|
|
defaultText = literalExpression "pkgs.tang";
|
|
description = "The tang package to use.";
|
|
};
|
|
|
|
listenStream = mkOption {
|
|
type = with types; listOf str;
|
|
default = [ "7654" ];
|
|
example = [
|
|
"198.168.100.1:7654"
|
|
"[2001:db8::1]:7654"
|
|
"7654"
|
|
];
|
|
description = ''
|
|
Addresses and/or ports on which tang should listen.
|
|
For detailed syntax see ListenStream in {manpage}`systemd.socket(5)`.
|
|
'';
|
|
};
|
|
|
|
ipAddressAllow = mkOption {
|
|
example = [ "192.168.1.0/24" ];
|
|
type = types.listOf types.str;
|
|
description = ''
|
|
Whitelist a list of address prefixes.
|
|
Preferably, internal addresses should be used.
|
|
'';
|
|
};
|
|
|
|
};
|
|
config = mkIf cfg.enable {
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
systemd.services."tangd@" = {
|
|
description = "Tang server";
|
|
path = [ cfg.package ];
|
|
serviceConfig = {
|
|
StandardInput = "socket";
|
|
StandardOutput = "socket";
|
|
StandardError = "journal";
|
|
DynamicUser = true;
|
|
StateDirectory = "tang";
|
|
RuntimeDirectory = "tang";
|
|
StateDirectoryMode = "700";
|
|
UMask = "0077";
|
|
CapabilityBoundingSet = [ "" ];
|
|
ExecStart = "${cfg.package}/libexec/tangd %S/tang";
|
|
LockPersonality = true;
|
|
MemoryDenyWriteExecute = true;
|
|
NoNewPrivileges = true;
|
|
DeviceAllow = [ "/dev/stdin" ];
|
|
RestrictAddressFamilies = [ "AF_UNIX" ];
|
|
DevicePolicy = "strict";
|
|
PrivateDevices = true;
|
|
PrivateTmp = true;
|
|
PrivateUsers = true;
|
|
ProcSubset = "pid";
|
|
ProtectClock = true;
|
|
ProtectControlGroups = true;
|
|
ProtectHome = true;
|
|
ProtectHostname = true;
|
|
ProtectKernelLogs = true;
|
|
ProtectKernelModules = true;
|
|
ProtectKernelTunables = true;
|
|
ProtectProc = "invisible";
|
|
ProtectSystem = "strict";
|
|
RestrictNamespaces = true;
|
|
RestrictRealtime = true;
|
|
RestrictSUIDSGID = true;
|
|
SystemCallArchitectures = "native";
|
|
SystemCallFilter = [
|
|
"@system-service"
|
|
"~@privileged"
|
|
"~@resources"
|
|
];
|
|
IPAddressDeny = "any";
|
|
IPAddressAllow = cfg.ipAddressAllow;
|
|
};
|
|
};
|
|
|
|
systemd.sockets.tangd = {
|
|
description = "Tang server";
|
|
wantedBy = [ "sockets.target" ];
|
|
socketConfig = {
|
|
ListenStream = cfg.listenStream;
|
|
Accept = "yes";
|
|
IPAddressDeny = "any";
|
|
IPAddressAllow = cfg.ipAddressAllow;
|
|
};
|
|
};
|
|
};
|
|
meta.maintainers = with lib.maintainers; [
|
|
jfroche
|
|
julienmalka
|
|
];
|
|
}
|