diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 1cd7cd6..32dcef3 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -3,6 +3,7 @@ # Include the results of the hardware scan. ./hardware-configuration.nix ./modules/users/users.nix + ./modules/system/networking.nix ]; # Bootloader. @@ -15,11 +16,6 @@ # Use latest kernel. boot.kernelPackages = pkgs.linuxPackages_latest; - # Networking - networking = { - hostName = "testVM"; # Define your hostname. - networkmanager.enable = true; - }; # Set your time zone. time.timeZone = "Europe/Berlin"; @@ -71,11 +67,6 @@ # Enable the OpenSSH daemon. services.openssh.enable = true; - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; system.stateVersion = "25.05"; # Did you read the comment? } diff --git a/nixos/modules/system/networking.nix b/nixos/modules/system/networking.nix index e69de29..6ed0b0e 100644 --- a/nixos/modules/system/networking.nix +++ b/nixos/modules/system/networking.nix @@ -0,0 +1,15 @@ +{ + config, + ... +}: { + networking = { + hostName = "nixOS"; + networkmanager.enable = true; + + firewall = { + enable = true; + # allowedTCPPorts = [ 80 443]; + # allowedUDPPorts = []; + }; + }; +}