diff --git a/configuration.nix b/configuration.nix index 8a07e00..4d794be 100755 --- a/configuration.nix +++ b/configuration.nix @@ -14,7 +14,7 @@ ./modules/nix-settings.nix ./modules/zfs.nix - (import ./modules/networking.nix {hostname = "server";}) + (import ./modules/networking-shared.nix {hostname = "server";}) (import ./modules/users.nix {main-user = "baritone";}) ]; diff --git a/flake.nix b/flake.nix index a2bb9c4..64baebe 100755 --- a/flake.nix +++ b/flake.nix @@ -51,7 +51,7 @@ inputs.home-manager.nixosModules.default inputs.simple-nixos-mailserver.nixosModule inputs.microvm.nixosModules.microvm - {microvm.hyprvisor = "qemu";} + {microvm.hypervisor = "qemu";} ]; in { server-vm = nixpkgs.lib.nixosSystem { @@ -91,6 +91,7 @@ ]; }) + ./modules/networking-metal.nix ./hardware-configuration.nix ./configuration.nix ] diff --git a/modules/networking-metal.nix b/modules/networking-metal.nix new file mode 100644 index 0000000..0faba8b --- /dev/null +++ b/modules/networking-metal.nix @@ -0,0 +1,27 @@ +{...}: +{ + networking.useDHCP = false; + + networking.wakeOnLan.enable = true; + networking.enp2s0.wakeOnLan.policy = "magic"; + + networking.interfaces.enp2s0 = { + ipv4.addresses = [ + { + address = "10.0.101.10"; + prefixLength = 24; + } + ]; + }; + + networking.defaultGateway = { + address = "10.0.101.1"; + interface = "enp2s0"; + }; + + networking.nameservers = [ + "10.0.101.1" + "8.8.8.8" + "8.8.4.4" + ]; +} diff --git a/modules/networking-shared.nix b/modules/networking-shared.nix new file mode 100755 index 0000000..d57c44b --- /dev/null +++ b/modules/networking-shared.nix @@ -0,0 +1,10 @@ +{hostname ? "server"}: {...}: { + networking.hostName = hostname; + networking.hostId = "2ead098f"; + networking.networkmanager.enable = true; + networking.firewall = { + enable = true; + allowedTCPPorts = []; + allowedUDPPorts = []; + }; +} diff --git a/modules/networking.nix b/modules/networking.nix deleted file mode 100755 index e9a131d..0000000 --- a/modules/networking.nix +++ /dev/null @@ -1,43 +0,0 @@ -{hostname ? "server"}: {...}: { - networking.hostName = hostname; - networking.hostId = "2ead098f"; - networking.networkmanager.enable = true; - networking.useDHCP = false; - # networking.resolvconf.dnsExtensionMechanism = false; - networking.firewall = { - enable = true; - allowedTCPPorts = []; - allowedUDPPorts = []; - }; - - networking.wakeOnLan.enable = true; - networking.enp2s0.wakeOnLan.policy = "magic"; - - networking.interfaces.enp2s0 = { - ipv4.addresses = [ - { - address = "10.0.101.10"; - prefixLength = 24; - } - ]; - }; - - networking.defaultGateway = { - address = "10.0.101.1"; - interface = "enp2s0"; - }; - - networking.nameservers = [ - "10.0.101.1" - "8.8.8.8" - "8.8.4.4" - ]; - - # Uncomment when domain is set up - # security.acme = { - # acceptTerms = true; - # certs = { - # defaults.email = "admin@spoodythe.one"; - # }; - # }; -}