2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.go-shadowsocks2.server;
|
|
|
|
in {
|
|
|
|
options.services.go-shadowsocks2.server = {
|
2022-09-09 14:08:57 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "go-shadowsocks2 server");
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
listenAddress = mkOption {
|
|
|
|
type = types.str;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Server listen address or URL";
|
2020-04-24 23:36:52 +00:00
|
|
|
example = "ss://AEAD_CHACHA20_POLY1305:your-password@:8488";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|