From a208ca4df2f507657403377fd6427226685f2228 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Sun, 14 Sep 2025 14:01:42 +0200 Subject: [PATCH] move more modules --- flake.nix | 6 ++ modules/desktop-hardware.nix | 60 +++++-------------- .../forgejo-runner-1/hardware.nix | 5 -- nixosConfigurations/hetzner-vpn2/hardware.nix | 5 -- nixosConfigurations/ronja-pc/hardware.nix | 4 +- nixosConfigurations/vinzenz-lpt2/hardware.nix | 37 ++++++------ nixosConfigurations/vinzenz-pc2/hardware.nix | 5 +- nixosModules/quiet-boot.nix | 11 ++++ nixosModules/systemd-boot.nix | 11 ++++ 9 files changed, 70 insertions(+), 74 deletions(-) create mode 100644 nixosModules/quiet-boot.nix create mode 100644 nixosModules/systemd-boot.nix diff --git a/flake.nix b/flake.nix index 2622042..bb522a6 100644 --- a/flake.nix +++ b/flake.nix @@ -116,6 +116,10 @@ modules = [ { networking.hostName = device; + nixpkgs = { + inherit system; + hostPlatform = lib.mkDefault system; + }; system = { stateVersion = "22.11"; autoUpgrade.flake = "git+https://git.berlin.ccc.de/vinzenz/nixos-configuration.git"; @@ -176,6 +180,8 @@ self.nixosModules.gnome self.nixosModules.modern-desktop self.nixosModules.nix-ld + self.nixosModules.quiet-boot + self.nixosModules.systemd-boot home-manager.nixosModules.home-manager servicepoint-simulator.nixosModules.default diff --git a/modules/desktop-hardware.nix b/modules/desktop-hardware.nix index a8b2f93..97c13fc 100644 --- a/modules/desktop-hardware.nix +++ b/modules/desktop-hardware.nix @@ -1,48 +1,20 @@ +{ lib, ... }: { - lib, - pkgs, - ... -}: -{ - config = { - boot = { - kernelPackages = pkgs.linuxPackages_zen; - kernelParams = [ - "quiet" - "udev.log_level=3" - ]; - supportedFilesystems = [ "btrfs" ]; - initrd.supportedFilesystems = [ "btrfs" ]; - consoleLogLevel = 0; - initrd.verbose = false; - plymouth.enable = true; - loader = { - timeout = 3; - efi.canTouchEfiVariables = true; - systemd-boot = { - enable = true; - editor = false; # do not allow changing kernel parameters - consoleMode = "max"; - }; - }; - }; + networking.networkmanager.enable = true; + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (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 + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true; - networking.networkmanager.enable = true; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (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 - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.eno1.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true; - - hardware = { - enableRedistributableFirmware = true; - bluetooth.enable = true; - }; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - - services.fwupd.enable = true; + hardware = { + enableRedistributableFirmware = true; + bluetooth.enable = true; }; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + services.fwupd.enable = true; } diff --git a/nixosConfigurations/forgejo-runner-1/hardware.nix b/nixosConfigurations/forgejo-runner-1/hardware.nix index e3e6880..e8fbc56 100644 --- a/nixosConfigurations/forgejo-runner-1/hardware.nix +++ b/nixosConfigurations/forgejo-runner-1/hardware.nix @@ -3,11 +3,6 @@ imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; config = { - nixpkgs = { - hostPlatform = "aarch64-linux"; - system = "aarch64-linux"; - }; - boot = { tmp.cleanOnBoot = true; kernelParams = [ "console=tty" ]; diff --git a/nixosConfigurations/hetzner-vpn2/hardware.nix b/nixosConfigurations/hetzner-vpn2/hardware.nix index e8fa931..d7c96f0 100644 --- a/nixosConfigurations/hetzner-vpn2/hardware.nix +++ b/nixosConfigurations/hetzner-vpn2/hardware.nix @@ -3,11 +3,6 @@ imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; config = { - nixpkgs = { - hostPlatform = "aarch64-linux"; - system = "aarch64-linux"; - }; - boot = { tmp.cleanOnBoot = true; kernelParams = [ "console=tty" ]; diff --git a/nixosConfigurations/ronja-pc/hardware.nix b/nixosConfigurations/ronja-pc/hardware.nix index f668726..56e653c 100644 --- a/nixosConfigurations/ronja-pc/hardware.nix +++ b/nixosConfigurations/ronja-pc/hardware.nix @@ -1,6 +1,7 @@ -{ lib, ... }: { boot = { + supportedFilesystems = [ "btrfs" ]; + initrd.supportedFilesystems = [ "btrfs" ]; kernelModules = [ "kvm-intel" ]; extraModulePackages = [ ]; initrd = { @@ -37,6 +38,5 @@ { device = "/dev/disk/by-uuid/bf9d19fb-499b-4bfb-b67d-131fa5bf8259"; } ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = true; } diff --git a/nixosConfigurations/vinzenz-lpt2/hardware.nix b/nixosConfigurations/vinzenz-lpt2/hardware.nix index 7a0f222..4effcf9 100644 --- a/nixosConfigurations/vinzenz-lpt2/hardware.nix +++ b/nixosConfigurations/vinzenz-lpt2/hardware.nix @@ -1,4 +1,9 @@ -{ lib, vinzenzNixosModules, ... }: +{ + lib, + vinzenzNixosModules, + pkgs, + ... +}: { imports = [ vinzenzNixosModules.intel-graphics ]; config = { @@ -9,11 +14,6 @@ ]; hardware.cpu.intel.updateMicrocode = true; - boot.loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - }; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (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 @@ -22,17 +22,20 @@ hardware.enableRedistributableFirmware = true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - - boot.initrd = { - availableKernelModules = [ - "xhci_pci" - "thunderbolt" - "nvme" - ]; - luks.devices = { - "luks-2c654ff2-3c42-48d3-a1e3-9545679afaa3" = { - device = "/dev/disk/by-uuid/2c654ff2-3c42-48d3-a1e3-9545679afaa3"; + boot = { + kernelPackages = pkgs.linuxPackages_zen; + supportedFilesystems = [ "btrfs" ]; + initrd = { + supportedFilesystems = [ "btrfs" ]; + availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + ]; + luks.devices = { + "luks-2c654ff2-3c42-48d3-a1e3-9545679afaa3" = { + device = "/dev/disk/by-uuid/2c654ff2-3c42-48d3-a1e3-9545679afaa3"; + }; }; }; }; diff --git a/nixosConfigurations/vinzenz-pc2/hardware.nix b/nixosConfigurations/vinzenz-pc2/hardware.nix index 1a72824..5a8751f 100644 --- a/nixosConfigurations/vinzenz-pc2/hardware.nix +++ b/nixosConfigurations/vinzenz-pc2/hardware.nix @@ -1,4 +1,4 @@ -{ vinzenzNixosModules, ... }: +{ vinzenzNixosModules, pkgs, ... }: { imports = [ vinzenzNixosModules.amd-graphics ]; config = { @@ -14,6 +14,9 @@ "usbhid" "sd_mod" ]; # "usb_storage" + kernelPackages = pkgs.linuxPackages_zen; + supportedFilesystems = [ "btrfs" ]; + initrd.supportedFilesystems = [ "btrfs" ]; loader.efi.efiSysMountPoint = "/boot"; }; diff --git a/nixosModules/quiet-boot.nix b/nixosModules/quiet-boot.nix new file mode 100644 index 0000000..8dbcd57 --- /dev/null +++ b/nixosModules/quiet-boot.nix @@ -0,0 +1,11 @@ +{ + boot = { + kernelParams = [ + "quiet" + "udev.log_level=3" + ]; + consoleLogLevel = 0; + initrd.verbose = false; + plymouth.enable = true; + }; +} diff --git a/nixosModules/systemd-boot.nix b/nixosModules/systemd-boot.nix new file mode 100644 index 0000000..321a26c --- /dev/null +++ b/nixosModules/systemd-boot.nix @@ -0,0 +1,11 @@ +{ + boot.loader = { + timeout = 3; + efi.canTouchEfiVariables = true; + systemd-boot = { + enable = true; + editor = false; # do not allow changing kernel parameters + consoleMode = "max"; + }; + }; +}