nixos-configs/devices/nos/modules/docker/wg-easy/compose.nix

49 lines
875 B
Nix
Raw Permalink Normal View History

2024-07-24 15:49:31 -04:00
{
config,
pkgs,
...
}: let
inherit (config.khepri) rwDataDir;
2024-02-28 13:43:07 -05:00
rwPath = rwDataDir + "/wg-easy";
in {
khepri.compositions."wg-easy" = {
networks.proxy_net = {external = true;};
services."wg-easy" = {
image = import ./images/wg-easy.nix pkgs;
restart = "always";
privileged = true;
capAdd = [
"NET_ADMIN"
"SYS_MODULE"
];
sysctls = [
"net.ipv4.ip_forward=1"
"net.ipv4.conf.all.src_valid_mark=1"
];
2024-02-28 13:43:07 -05:00
environment = {
WG_HOST = "nelim.org";
WG_PORT = "51820";
WG_DEFAULT_ADDRESS = "10.6.0.x";
WG_DEFAULT_DNS = "1.0.0.1";
};
volumes = [
"${rwPath}/data:/etc/wireguard"
];
ports = [
"53:51820/udp"
"51822:51820/udp"
"51821:51821/tcp"
];
networks = ["proxy_net"];
};
2024-02-28 13:43:07 -05:00
};
}