CHANGES: NetworkManager to systemd-networkd

This commit is contained in:
DuN0z 2025-10-04 09:46:20 +02:00
parent bb18183277
commit fd9f5e202c
6 changed files with 41 additions and 20 deletions

View file

@ -20,7 +20,6 @@
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "terre-neuvas"; # Define your hostname. networking.hostName = "terre-neuvas"; # Define your hostname.
networking.networkmanager.enable = true;
# Configure keymap in X11 # Configure keymap in X11
services.xserver.xkb = { services.xserver.xkb = {
@ -33,7 +32,7 @@
users.users.lomig = { users.users.lomig = {
isNormalUser = true; isNormalUser = true;
extraGroups = ["networkmanager" "lp" "wheel" "docker" ]; extraGroups = [ "lp" "wheel" "docker" ];
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
@ -50,8 +49,40 @@
hugo hugo
]; ];
networking = { networking = {
firewall.allowedTCPPorts = [ 80 5900 5901 5902 ]; useNetworkd = true ;
firewall.allowedTCPPorts = [ 22 80 5900 5901 5902 ];
interfaces.eno1.useDHCP = false ;
interfaces.br0 = {
useDHCP = false ;
ipv4.addresses = [
{
address = "192.168.0.3";
prefixLength = 24 ;
}
];
};
defaultGateway = {
interface = "br0" ;
address = "192.168.0.254" ;
};
nameservers = [ "192.168.0.254" "1.1.1.1" ];
bridges.br0.interfaces = [ "eno1" ]; bridges.br0.interfaces = [ "eno1" ];
}; };
systemd.network = {
enable = true ;
netdevs."br0" = {
netdevConfig = {
Name = "br0";
Kind = "bridge";
};
};
networks."br0" = {
matchConfig.Name = "br0" ;
};
networks."eno1" = {
matchConfig.Name = "eno1";
networkConfig.Bridge = "br0";
};
};
system.stateVersion = "25.05"; # Did you read the comment? system.stateVersion = "25.05"; # Did you read the comment?
} }

View file

@ -10,7 +10,7 @@
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = lib.mkAfter [ "kvm-intel" "tun" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
@ -37,7 +37,7 @@
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction # still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true; # networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true; # networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;

View file

@ -1,8 +1,7 @@
_: { _: {
networking = { networking = {
networkmanager.enable = true;
nameservers = ["1.1.1.1" "8.8.8.8"]; nameservers = ["1.1.1.1" "8.8.8.8"];
dhcpcd.extraConfig = "nohook resolv.conf"; # dhcpcd.extraConfig = "nohook resolv.conf";
firewall.enable = true; firewall.enable = true;
interfaces.enp11s0.wakeOnLan.enable = true ; interfaces.enp11s0.wakeOnLan.enable = true ;
}; };

View file

@ -28,14 +28,6 @@
}; };
users.users.lomig.extraGroups = ["libvirtd" "kvm" "input"]; users.users.lomig.extraGroups = ["libvirtd" "kvm" "input"];
networking = {
useDHCP = false;
};
systemd.network.networks."10-br0" = {
matchConfig.Name = "br0";
networkConfig.DHCP = "yes";
};
environment.etc."qemu/bridge.conf".text = '' environment.etc."qemu/bridge.conf".text = ''
allow br0 allow br0

View file

@ -42,8 +42,8 @@
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# 3⃣ Ouverture du firewall (ports 80 et 443) # 3⃣ Ouverture du firewall (ports 80 et 443)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
networking.firewall.allowedTCPPorts = [ # networking.firewall.allowedTCPPorts = [
80 # HTTP (pour la redirection ACME) # 80 # HTTP (pour la redirection ACME)
443 # HTTPS (site final) # 443 # HTTPS (site final)
]; # ];
} }

View file

@ -2,7 +2,6 @@
imports = [ imports = [
../modules/roles/server.nix ../modules/roles/server.nix
../modules/common/base.nix ../modules/common/base.nix
../modules/common/networking.nix
../modules/common/qemu.nix ../modules/common/qemu.nix
../modules/services/printing.nix ../modules/services/printing.nix
# ../modules/services/goaccess.nix # ../modules/services/goaccess.nix