Shadowsocks module

This commit is contained in:
pazpi 2025-03-20 21:45:22 +01:00
parent 49cfefa8af
commit 90b8a5f8b7
4 changed files with 45 additions and 9 deletions

View file

@ -0,0 +1,37 @@
{
lib,
config,
pkgs,
...
}:
let
cfg = config.my.networking.shadowsocks;
in
{
options.my.networking.shadowsocks = {
enable = lib.mkEnableOption "Enable Shadowsocks relay";
port = lib.mkOption {
type = lib.types.int;
default = 8388;
description = "Port to listen on";
};
passwordFile = lib.mkOption {
type = lib.types.path;
default = "/var/lib/shadowsocks/password";
description = "File with the Shadowsocks relay access password";
};
};
config = lib.mkIf cfg.enable {
services.shadowsocks = lib.mkIf cfg.enable {
enable = true;
passwordFile = cfg.passwordFile;
port = cfg.port;
};
# open shadownsocks port
networking.firewall.allowedTCPPorts = [ cfg.port ];
};
}