From 302e3711d3aa6c9d332eaeff421b5d0669bd1287 Mon Sep 17 00:00:00 2001 From: ed209 Date: Tue, 13 Jan 2026 07:04:46 -0500 Subject: [PATCH] feat: add networking module Simple networking module to start, just enable NetworkManager and set hostname for now. --- hosts/sachiel/configuration.nix | 15 +++------ modules/nixos/default.nix | 1 + modules/nixos/system/network/default.nix | 43 ++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 modules/nixos/system/network/default.nix diff --git a/hosts/sachiel/configuration.nix b/hosts/sachiel/configuration.nix index 46fd847..f1903ca 100644 --- a/hosts/sachiel/configuration.nix +++ b/hosts/sachiel/configuration.nix @@ -15,6 +15,7 @@ outputs.nixosModules.agenix outputs.nixosModules.impermanence outputs.nixosModules.user + outputs.nixosModules.network # Or modules from other flakes (such as nixos-hardware): # inputs.hardware.nixosModules.common-cpu-amd @@ -50,6 +51,10 @@ enable = true; secureBoot = true; }; + network = { + hostname = "sachiel-vm"; + wireless.enable = true; + }; }; nixpkgs = { @@ -95,16 +100,6 @@ nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; }; - networking.hostName = "sachiel-vm"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking - networking.networkmanager.enable = true; - # Set your time zone. time.timeZone = inputs.nix-secrets.timeZone; diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 18db1ca..a35bb3b 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -5,5 +5,6 @@ agenix = import ./system/agenix/default.nix; boot = import ./system/boot/default.nix; impermanence = import ./system/impermanence/default.nix; + network = import ./system/network/default.nix; user = import ./user/default.nix; } diff --git a/modules/nixos/system/network/default.nix b/modules/nixos/system/network/default.nix new file mode 100644 index 0000000..bef1d54 --- /dev/null +++ b/modules/nixos/system/network/default.nix @@ -0,0 +1,43 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.system.network; +in { + options.system.network = { + hostName = mkOption { + example = "sachiel-vm"; + type = types.str; + description = "System hostname"; + }; + + wireless.enable = mkEnableOption "Enable wireless"; + }; + + config = { + networking = { + inherit (cfg) hostName; + wireless.iwd = mkIf cfg.wireless.enable { + enable = true; + settings = { + Network = { + EnableIPv6 = true; + }; + Settings = { + AutoConnect = true; + }; + }; + }; + + # Configure network proxy if necessary + # proxy.default = "http://user:password@proxy:port/"; + # proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networkmanager.enable = true; + networking.networkmanager.wifi.backend = "iwd"; + }; + }; +} -- 2.51.2