From abd055702bb8a6ddca6ba8babf6471a62bad0174 Mon Sep 17 00:00:00 2001 From: monologiq Date: Wed, 24 Dec 2025 16:56:09 +0100 Subject: [PATCH] Merge networking.nix and cleanup --- machines/persephone.nix | 5 +- machines/persephone/networking.nix | 51 ---------------- profiles/desktop.linux.nix | 97 ++++++++++++++++++++---------- profiles/minimal.linux.nix | 19 ++++-- profiles/minimal.nix | 16 ++++- 5 files changed, 97 insertions(+), 91 deletions(-) delete mode 100644 machines/persephone/networking.nix diff --git a/machines/persephone.nix b/machines/persephone.nix index e35648e..4a1dd15 100644 --- a/machines/persephone.nix +++ b/machines/persephone.nix @@ -2,14 +2,11 @@ config, lib, pkgs, - modulesPath, ... }: { imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ./persephone/networking.nix ../profiles/minimal.linux.nix ../profiles/desktop.linux.nix ]; @@ -122,6 +119,8 @@ lm_sensors ]; + networking.wireless.iwd.enable = true; + nix.settings = { substituters = [ "https://cache.nixos-cuda.org" ]; trusted-public-keys = [ "cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M=" ]; diff --git a/machines/persephone/networking.nix b/machines/persephone/networking.nix deleted file mode 100644 index 263f66b..0000000 --- a/machines/persephone/networking.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ lib, ... }: - -{ - - networking.hostName = "persephone"; - - networking.useDHCP = lib.mkDefault true; - - networking.wireless.iwd = { - enable = true; - settings = { - General = { - EnableNetworkConfiguration = false; # Let dhcpcd handle this - }; - Network = { - EnableIPv6 = true; - NameResolvingService = "systemd"; - }; - }; - }; - - networking.dhcpcd = { - enable = true; - extraConfig = '' - nohook resolv.conf # Don't let dhcpcd manage resolv.conf - ''; - }; - - networking.resolvconf.enable = false; - - services.avahi.enable = true; - - services.resolved = { - enable = true; - - dnssec = "true"; - domains = [ "~." ]; - fallbackDns = [ - "9.9.9.9#dns.quad9.net" - "149.112.112.112#dns.quad9.net" - "2620:fe::fe#dns.quad9.net" - "2620:fe::9#dns.quad9.net" - ]; - - extraConfig = '' - DNSOverTLS=yes - ''; - }; - - services.openssh.enable = true; -} diff --git a/profiles/desktop.linux.nix b/profiles/desktop.linux.nix index 1943b2d..1e4d046 100644 --- a/profiles/desktop.linux.nix +++ b/profiles/desktop.linux.nix @@ -6,23 +6,31 @@ }: let inherit (lib) mkForce mkIf; - - sessionVariables = { - NIXOS_OZONE_WL = "1"; - }; - - systemPackages = with pkgs; [ - adwaita-icon-theme - ddcutil - gsettings-desktop-schemas - libva-utils - sbctl - vdpauinfo - ]; in { environment = { - inherit sessionVariables systemPackages; + sessionVariables = { + NIXOS_OZONE_WL = "1"; + }; + + systemPackages = with pkgs; [ + adwaita-icon-theme + ddcutil + gsettings-desktop-schemas + libva-utils + sbctl + vdpauinfo + ]; + }; + + environment.etc = mkIf config.programs._1password-gui.enable { + "1password/custom_allowed_browsers" = { + text = '' + firefox + brave + ''; + mode = "0755"; + }; }; fonts.fontconfig = { @@ -59,24 +67,34 @@ in }; }; - programs.dconf.enable = config.programs.niri.enable; - security.polkit.enable = config.programs.niri.enable; + networking.wireless.iwd = { + enable = true; + settings = { + General = { + EnableNetworkConfiguration = false; # Let dhcpcd handle this + }; + Network = { + EnableIPv6 = true; + NameResolvingService = "systemd"; + }; + }; + }; + + networking.dhcpcd = { + enable = true; + extraConfig = '' + nohook resolv.conf # Don't let dhcpcd manage resolv.conf + ''; + }; + + networking.resolvconf.enable = !config.services.resolved.enable; programs._1password-gui = mkIf config.programs._1password.enable { enable = true; polkitPolicyOwners = [ "pml" ]; }; - environment.etc = mkIf config.programs._1password-gui.enable { - "1password/custom_allowed_browsers" = { - text = '' - firefox - brave - ''; - mode = "0755"; - }; - }; - + programs.dconf.enable = config.programs.niri.enable; programs.niri.enable = true; programs.regreet = { @@ -93,6 +111,7 @@ in programs.zsh.enable = true; + security.polkit.enable = config.programs.niri.enable; security.rtkit.enable = config.services.pipewire.enable; services.pipewire = mkIf config.services.pipewire.enable { @@ -102,10 +121,26 @@ in jack.enable = true; }; - system.activationScripts.openrgbOff = - mkIf (config.services.hardware.openrgb.startupProfile == "off") '' - mkdir -p /var/lib/OpenRGB - cp ${../config/openrgb/off.orp} /var/lib/OpenRGB/off.orp - chmod 0644 /var/lib/OpenRGB/off.orp + services.resolved = { + enable = true; + dnssec = "true"; + domains = [ "~." ]; + fallbackDns = [ + "9.9.9.9#dns.quad9.net" + "149.112.112.112#dns.quad9.net" + "2620:fe::fe#dns.quad9.net" + "2620:fe::9#dns.quad9.net" + ]; + extraConfig = '' + DNSOverTLS=yes ''; + }; + + system.activationScripts.openrgbOff = + mkIf (config.services.hardware.openrgb.startupProfile == "off") + '' + mkdir -p /var/lib/OpenRGB + cp ${../config/openrgb/off.orp} /var/lib/OpenRGB/off.orp + chmod 0644 /var/lib/OpenRGB/off.orp + ''; } diff --git a/profiles/minimal.linux.nix b/profiles/minimal.linux.nix index b2632d7..9fc8630 100644 --- a/profiles/minimal.linux.nix +++ b/profiles/minimal.linux.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: let bootUUID = config.machine.fs.bootUUID; efiUUID = config.machine.fs.efiUUID; @@ -6,11 +12,15 @@ let cryptrootUUID = config.machine.fs.cryptrootUUID; in { - imports = [ ./minimal.nix ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ./minimal.nix + ]; boot.bootspec.enable = true; boot.initrd = { kernelModules = [ ]; + luks.devices."cryptroot".device = "/dev/disk/by-uuid/${luuksUUID}"; systemd.enable = true; }; @@ -43,8 +53,6 @@ in ]; }; - boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/${luuksUUID}"; - environment.sessionVariables = { EDITOR = "${pkgs.vim}/bin/vim"; PAGER = "${pkgs.less}/bin/less"; @@ -104,6 +112,9 @@ in options = [ "subvol=@var_lib_portables" ]; }; + services.avahi.enable = true; + services.openssh.enable = true; + swapDevices = [ ]; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/profiles/minimal.nix b/profiles/minimal.nix index 0a68c4c..641b8d4 100644 --- a/profiles/minimal.nix +++ b/profiles/minimal.nix @@ -1,5 +1,12 @@ -{ pkgs, ... }: - +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) mkDefault; +in { environment.systemPackages = with pkgs; [ curl @@ -8,6 +15,11 @@ wget ]; + networking = { + hostName = "${config.machine.hostName}"; + useDHCP = mkDefault true; + }; + nix.package = pkgs.lixPackageSets.stable.lix; nix.settings = {