interfaces and package config externalized, also tmux added and version variable
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{ config, pkgs, ... }: {
|
||||
{ config, lib, pkgs, ... }: {
|
||||
|
||||
networking.nat.enable = true;
|
||||
networking.nat.externalInterface = "enp1s0";
|
||||
networking.nat.internalInterfaces = [ "wg0" ];
|
||||
networking.nat.externalInterface = lib.head config.vars.interfaces;
|
||||
networking.nat.internalInterfaces = [ "wg0" ] ++ config.vars.interfaces;
|
||||
|
||||
networking.wg-quick.interfaces = {
|
||||
wg0 = {
|
||||
@@ -11,11 +11,11 @@
|
||||
autostart = true;
|
||||
postUp = ''
|
||||
${pkgs.iptables}/bin/iptables -A FORWARD -i wg0 -j ACCEPT
|
||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -o enp1s0 -j MASQUERADE
|
||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -o ${lib.head config.vars.interfaces} -j MASQUERADE
|
||||
'';
|
||||
postDown = ''
|
||||
${pkgs.iptables}/bin/iptables -D FORWARD -i wg0 -j ACCEPT
|
||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -o enp1s0
|
||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -o ${lib.head config.vars.interfaces}
|
||||
'';
|
||||
privateKey = config.vars.wg_privateKey;
|
||||
peers = [{
|
||||
@@ -27,5 +27,6 @@
|
||||
}];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
environment.systemPackages = [ pkgs.wireguard-tools ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user