1
0
Fork 0

Compare commits

..

2 commits

Author SHA1 Message Date
0166fc858b
Update flake
Some checks failed
Build / build-amd64-linux (push) Failing after 3m10s
Build / build-arm64-linux (push) Failing after 3m36s
2024-11-03 18:22:36 +01:00
7f9245ed94
wg: fix 2024-11-03 15:27:06 +01:00
2 changed files with 29 additions and 29 deletions

View file

@ -296,11 +296,11 @@
]
},
"locked": {
"lastModified": 1730490306,
"narHash": "sha256-AvCVDswOUM9D368HxYD25RsSKp+5o0L0/JHADjLoD38=",
"lastModified": 1730633670,
"narHash": "sha256-ZFJqIXpvVKvzOVFKWNRDyIyAo+GYdmEPaYi1bZB6uf0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1743615b61c7285976f85b303a36cdf88a556503",
"rev": "8f6ca7855d409aeebe2a582c6fd6b6a8d0bf5661",
"type": "github"
},
"original": {
@ -337,7 +337,7 @@
"narHash": "sha256-6U0CyPycIBc04hbYy2hBINnVso58n/ZyywY2BD3hu+s=",
"rev": "9098ac95768f7006d7e070b88bae76939f6034e6",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/9098ac95768f7006d7e070b88bae76939f6034e6.tar.gz"
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/9098ac95768f7006d7e070b88bae76939f6034e6.tar.gz?rev=9098ac95768f7006d7e070b88bae76939f6034e6"
},
"original": {
"type": "tarball",
@ -493,11 +493,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1730555274,
"narHash": "sha256-dYSnUmWkVwwEpXv0F/fZBBYT10Bgx+U2PJ2obdBTqo8=",
"lastModified": 1730599252,
"narHash": "sha256-gCkK9sTqEKYRM5db5nPydip//4mQfiW3GTEw874bYps=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cf3e5d3744dc26c3498aa5dadfa0e078c632cede",
"rev": "3ce0ea52a0a71ac04f4ce0a2c8a629e02a4e6279",
"type": "github"
},
"original": {

View file

@ -34,8 +34,8 @@
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.iproute}/bin/ip netns add %I";
ExecStop = "${pkgs.iproute}/bin/ip netns del %I";
ExecStart = "${pkgs.iproute2}/bin/ip netns add %I";
ExecStop = "${pkgs.iproute2}/bin/ip netns del %I";
};
};
@ -56,35 +56,35 @@
ExecStart = with pkgs; writers.writeBash "wg-up" ''
set -e
echo "Setting lo to up ..."
${iproute}/bin/ip -n wg link set lo up
${iproute2}/bin/ip -n wg link set lo up
echo "Creating veth network ..."
${iproute}/bin/ip link add name vethwghost0 type veth peer vethwgns0 netns wg
${iproute}/bin/ip address add 192.168.42.1/24 dev vethwghost0
${iproute}/bin/ip -n wg address add 192.168.42.2/24 dev vethwgns0
${iproute}/bin/ip link set vethwghost0 up
${iproute}/bin/ip -n wg link set vethwgns0 up
${iproute2}/bin/ip link add name vethwghost0 type veth peer vethwgns0 netns wg
${iproute2}/bin/ip address add 192.168.42.1/24 dev vethwghost0
${iproute2}/bin/ip -n wg address add 192.168.42.2/24 dev vethwgns0
${iproute2}/bin/ip link set vethwghost0 up
${iproute2}/bin/ip -n wg link set vethwgns0 up
echo "Creating wg0 interface ..."
${iproute}/bin/ip link add wg0 type wireguard
${iproute2}/bin/ip link add wg0 type wireguard
${wireguard-tools}/bin/wg setconf wg0 ${config.age.secrets.wireguard-config.path}
${iproute}/bin/ip link set wg0 netns wg
${iproute}/bin/ip -n wg address add ${secret.wireguard.ipv4} dev wg0
${iproute}/bin/ip -n wg -6 address add ${secret.wireguard.ipv6} dev wg0
${iproute}/bin/ip -n wg link set wg0 mtu 1320
${iproute}/bin/ip -n wg link set wg0 up
${iproute}/bin/ip -n wg route add default dev wg0
${iproute}/bin/ip -n wg -6 route add default dev wg0
${iproute2}/bin/ip link set wg0 netns wg
${iproute2}/bin/ip -n wg address add ${secret.wireguard.ipv4} dev wg0
${iproute2}/bin/ip -n wg -6 address add ${secret.wireguard.ipv6} dev wg0
${iproute2}/bin/ip -n wg link set wg0 mtu 1320
${iproute2}/bin/ip -n wg link set wg0 up
${iproute2}/bin/ip -n wg route add default dev wg0
${iproute2}/bin/ip -n wg -6 route add default dev wg0
echo "Done!"
'';
ExecStop = with pkgs; writers.writeBash "wg-down" ''
echo "Tearing down wg0 ..."
${iproute}/bin/ip -n wg route del default dev wg0
${iproute}/bin/ip -n wg -6 route del default dev wg0
${iproute}/bin/ip -n wg link del wg0
${iproute2}/bin/ip -n wg route del default dev wg0
${iproute2}/bin/ip -n wg -6 route del default dev wg0
${iproute2}/bin/ip -n wg link del wg0
echo "Tearing down veth network ..."
${iproute}/bin/ip link del vethwghost0
${iproute}/bin/ip -n wg link del vethwgns0
${iproute2}/bin/ip link del vethwghost0
${iproute2}/bin/ip -n wg link del vethwgns0
echo "Setting lo to down ..."
${iproute}/bin/ip -n wg link set lo down
${iproute2}/bin/ip -n wg link set lo down
echo "Done!"
'';
};