mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
dante service: init
This commit is contained in:
parent
efec7d9787
commit
49d679d7a8
2 changed files with 62 additions and 0 deletions
|
@ -346,6 +346,7 @@
|
||||||
./services/networking/connman.nix
|
./services/networking/connman.nix
|
||||||
./services/networking/consul.nix
|
./services/networking/consul.nix
|
||||||
./services/networking/coturn.nix
|
./services/networking/coturn.nix
|
||||||
|
./services/networking/dante.nix
|
||||||
./services/networking/ddclient.nix
|
./services/networking/ddclient.nix
|
||||||
./services/networking/dhcpcd.nix
|
./services/networking/dhcpcd.nix
|
||||||
./services/networking/dhcpd.nix
|
./services/networking/dhcpd.nix
|
||||||
|
|
61
nixos/modules/services/networking/dante.nix
Normal file
61
nixos/modules/services/networking/dante.nix
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.dante;
|
||||||
|
confFile = pkgs.writeText "dante-sockd.conf" ''
|
||||||
|
user.privileged: root
|
||||||
|
user.unprivileged: dante
|
||||||
|
|
||||||
|
${cfg.config}
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
meta = {
|
||||||
|
maintainers = with maintainers; [ arobyn ];
|
||||||
|
};
|
||||||
|
|
||||||
|
options = {
|
||||||
|
services.dante = {
|
||||||
|
enable = mkEnableOption "Dante SOCKS proxy";
|
||||||
|
|
||||||
|
config = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
Contents of Dante's configuration file
|
||||||
|
NOTE: user.privileged/user.unprivileged are set by the service
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
{ assertion = cfg.config != null;
|
||||||
|
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";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${pkgs.dante}/bin/sockd -f ${confFile}";
|
||||||
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||||
|
Restart = "always";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue