1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-21 00:49:27 +03:00
nixpkgs/nixos/modules/services/networking/go-shadowsocks2.nix

35 lines
768 B
Nix
Raw Normal View History

{
config,
lib,
pkgs,
...
}:
2019-08-26 19:39:36 +02:00
let
cfg = config.services.go-shadowsocks2.server;
in
{
2019-08-26 19:39:36 +02:00
options.services.go-shadowsocks2.server = {
enable = lib.mkEnableOption "go-shadowsocks2 server";
2019-08-26 19:39:36 +02:00
listenAddress = lib.mkOption {
type = lib.types.str;
description = "Server listen address or URL";
2019-08-26 19:39:36 +02:00
example = "ss://AEAD_CHACHA20_POLY1305:your-password@:8488";
};
};
config = lib.mkIf cfg.enable {
2019-08-26 19:39:36 +02:00
systemd.services.go-shadowsocks2-server = {
description = "go-shadowsocks2 server";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.go-shadowsocks2}/bin/go-shadowsocks2 -s '${cfg.listenAddress}'";
DynamicUser = true;
};
};
};
}