Apply variable overhaul to server as well

This commit is contained in:
Jimbo 2024-09-23 16:27:23 -04:00
parent 6dab8fc029
commit 7759fd1fa9
2 changed files with 11 additions and 15 deletions

View file

@ -1,16 +1,14 @@
{ {outputs, ...}: {
services = { services = {
samba = { samba = {
enable = true; enable = true;
securityType = "user"; securityType = "user";
openFirewall = true; openFirewall = true;
extraConfig = let extraConfig = ''
ips = import ../modules/ips.nix;
in ''
workgroup = WORKGROUP workgroup = WORKGROUP
server string = JimSMB server string = JimSMB
security = user security = user
hosts allow = ${ips.localSpan}. 127.0.0.1 localhost hosts allow = ${outputs.ips.localSpan}. 127.0.0.1 localhost
hosts deny = 0.0.0.0/0 hosts deny = 0.0.0.0/0
guest account = nobody guest account = nobody
map to guest = bad user map to guest = bad user

View file

@ -1,12 +1,10 @@
{outputs, ...}: let {outputs, ...}: {
ips = import ../modules/ips.nix;
in {
# Enable NAT # Enable NAT
networking = { networking = {
nat = { nat = {
enable = true; enable = true;
externalInterface = "${ips.netInt}"; externalInterface = "${outputs.ips.netInt}";
internalInterfaces = [ "${ips.wgInt}" ]; internalInterfaces = [ "${outputs.ips.wgInt}" ];
}; };
firewall.allowedUDPPorts = [ 51820 ]; firewall.allowedUDPPorts = [ 51820 ];
}; };
@ -14,22 +12,22 @@ in {
networking.wireguard = { networking.wireguard = {
enable = true; enable = true;
interfaces = { interfaces = {
"${ips.wgInt}" = { "${outputs.ips.wgInt}" = {
ips = [ "${ips.wgSpan}.1/24" ]; ips = [ "${outputs.ips.wgSpan}.1/24" ];
listenPort = 51820; listenPort = 51820;
privateKey = outputs.secrets.wgServerPriv; privateKey = outputs.secrets.wgServerPriv;
peers = [ peers = [
{ # Jimbo Pixel 9 { # Jimbo Pixel 9
publicKey = outputs.secrets.wgPixel9Pub; publicKey = outputs.secrets.wgPixel9Pub;
allowedIPs = [ "${ips.wgSpan}.2/32" ]; allowedIPs = [ "${outputs.ips.wgSpan}.2/32" ];
} }
{ # Oracle VM { # Oracle VM
publicKey = outputs.secrets.wgOraclePub; publicKey = outputs.secrets.wgOraclePub;
allowedIPs = [ "${ips.wgSpan}.3/32" ]; allowedIPs = [ "${outputs.ips.wgSpan}.3/32" ];
} }
{ # General Nix { # General Nix
publicKey = outputs.secrets.wgClientPub; publicKey = outputs.secrets.wgClientPub;
allowedIPs = [ "${ips.wgSpan}.16/28" ]; allowedIPs = [ "${outputs.ips.wgSpan}.16/28" ];
} }
]; ];
}; };