From 3d2efa3b8a03078996dff705b73bbda65b33dbdc Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Tue, 17 Jan 2023 17:20:22 +0000 Subject: [PATCH] feat: better handling if ip and networking --- machines/agentjones.nix | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/machines/agentjones.nix b/machines/agentjones.nix index 7af9c23..60b38af 100644 --- a/machines/agentjones.nix +++ b/machines/agentjones.nix @@ -1,25 +1,50 @@ -{ pkgs, lib, nodes, ... }: { +{ pkgs, lib, nodes, ... }: +let + # ip = "193.1.99.72"; + ip = "192.168.1.157"; + ip_priv = "172.20.20.1"; + # hostname = "agentjones.skynet.ie"; + hostname = "192.168.1.157"; + +in { imports = [ # applications for this particular server ../applications/firewall.nix ]; deployment = { - #targetHost = "agentjones.skynet.ie"; - # wont have dns to start with - #targetHost = "193.1.99.72"; - targetHost = "192.168.1.157"; + targetHost = hostname; targetPort = 22; targetUser = "root"; }; + # this has to be defined for any physical servers + # vms are defined by teh vm host + networking.interfaces = { + eth0 = { + ipv4.addresses = [ + { + address = "${ip}/32"; + prefixLength = 24; + } + ]; + }; + priv0 = { + ipv4.addresses = [ + { + address = "${ip_priv}/32"; + prefixLength = 24; + } + ]; + }; + }; + # this server is teh firewall skynet_firewall = { # always good to know oneself own = { - #ip = "193.1.99.72"; - ip = "192.168.1.157"; + ip = ip; ports = { tcp = [