6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
63 lines
1.6 KiB
Nix
63 lines
1.6 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.dante;
|
|
confFile = pkgs.writeText "dante-sockd.conf" ''
|
|
user.privileged: root
|
|
user.unprivileged: dante
|
|
logoutput: syslog
|
|
|
|
${cfg.config}
|
|
'';
|
|
in
|
|
|
|
{
|
|
meta = {
|
|
maintainers = with maintainers; [ arobyn ];
|
|
};
|
|
|
|
options = {
|
|
services.dante = {
|
|
enable = mkEnableOption "Dante SOCKS proxy";
|
|
|
|
config = mkOption {
|
|
type = types.lines;
|
|
description = ''
|
|
Contents of Dante's configuration file.
|
|
NOTE: user.privileged, user.unprivileged and logoutput are set by the service.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
assertions = [
|
|
{ assertion = cfg.config != "";
|
|
message = "please provide Dante configuration file contents";
|
|
}
|
|
];
|
|
|
|
users.users.dante = {
|
|
description = "Dante SOCKS proxy daemon user";
|
|
isSystemUser = true;
|
|
group = "dante";
|
|
};
|
|
users.groups.dante = {};
|
|
|
|
systemd.services.dante = {
|
|
description = "Dante SOCKS v4 and v5 compatible proxy server";
|
|
wants = [ "network-online.target" ];
|
|
after = [ "network-online.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
ExecStart = "${pkgs.dante}/bin/sockd -f ${confFile}";
|
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
|
# Can crash sometimes; see https://github.com/NixOS/nixpkgs/pull/39005#issuecomment-381828708
|
|
Restart = "on-failure";
|
|
};
|
|
};
|
|
};
|
|
}
|