mirror of
https://github.com/MagicBOTAlex/nixos-server.git
synced 2026-05-06 10:02:30 +02:00
sync
This commit is contained in:
parent
38d26110e1
commit
f2bb1de7d8
15 changed files with 505 additions and 87 deletions
30
networking/wireguard-kube.nix
Normal file
30
networking/wireguard-kube.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Ensure the necessary tools are installed
|
||||
environment.systemPackages = [ pkgs.wireguard-tools ];
|
||||
|
||||
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
|
||||
|
||||
systemd.services.wireguard-kube = {
|
||||
description = "WireGuard VPN Service for kube-wg";
|
||||
|
||||
# Ensure the service starts after the network is up
|
||||
after = [
|
||||
"network.target"
|
||||
"network-online.target"
|
||||
];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
|
||||
# Use wg-quick to setup and teardown the interface
|
||||
ExecStart = "${pkgs.wireguard-tools}/bin/wg-quick up /etc/wireguard/wireguard-kube.conf";
|
||||
ExecStop = "${pkgs.wireguard-tools}/bin/wg-quick down /etc/wireguard/wireguard-kube.conf";
|
||||
CapabilityBoundingSet = "CAP_NET_ADMIN CAP_NET_RAW";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue