From 08d98ade6f58878de0893109b323c23b38c876fb Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 14 Jun 2024 21:18:00 -0400 Subject: [PATCH] reorganized hardware files and enabled firmware --- hosts/fallarbor/hardware.nix | 65 ++++++++++++++++------------- hosts/lavaridge/hardware.nix | 49 ++++++++++++---------- hosts/mandarin/hardware.nix | 5 +++ hosts/mauville/hardware.nix | 81 +++++++++++++++++++----------------- hosts/petalburg/hardware.nix | 71 +++++++++++++++++-------------- hosts/rustboro/hardware.nix | 78 +++++++++++++++++++--------------- 6 files changed, 194 insertions(+), 155 deletions(-) diff --git a/hosts/fallarbor/hardware.nix b/hosts/fallarbor/hardware.nix index 4bbdc412..68c29e8f 100644 --- a/hosts/fallarbor/hardware.nix +++ b/hosts/fallarbor/hardware.nix @@ -1,9 +1,9 @@ { config, - lib, - pkgs, - modulesPath, inputs, + lib, + modulesPath, + pkgs, ... }: { imports = [ @@ -11,41 +11,50 @@ inputs.nixos-hardware.nixosModules.framework-11th-gen-intel ]; - boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; + boot = { + initrd = { + availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; + kernelModules = []; + }; - # Intel drivers with accelerated video playback support. - nixpkgs.config.packageOverrides = pkgs: { - intel-vaapi-driver = - pkgs.intel-vaapi-driver.override {enableHybridCodec = true;}; + extraModulePackages = []; + kernelModules = ["kvm-intel"]; }; - hardware.opengl = { - enable = true; - extraPackages = with pkgs; [ - intel-media-driver # LIBVA_DRIVER_NAME=iHD - intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) - libvdpau-va-gl - ]; + # Intel drivers with accelerated video playback support. + nixpkgs = { + config.packageOverrides = pkgs: { + intel-vaapi-driver = + pkgs.intel-vaapi-driver.override {enableHybridCodec = true;}; + }; + + hostPlatform = lib.mkDefault "x86_64-linux"; + }; + + hardware = { + cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; + + enableAllFirmware = true; + + opengl = { + enable = true; + + extraPackages = with pkgs; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + libvdpau-va-gl + ]; + }; }; environment.sessionVariables = { - LIBVA_DRIVER_NAME = "iHD"; - }; # Force intel-media-driver + LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver + }; # Save power/better manage heat & fans. powerManagement.powertop.enable = true; services.thermald.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; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/lavaridge/hardware.nix b/hosts/lavaridge/hardware.nix index 67f7c097..54ebd559 100644 --- a/hosts/lavaridge/hardware.nix +++ b/hosts/lavaridge/hardware.nix @@ -3,10 +3,10 @@ # to /etc/nixos/configuration.nix instead. { config, - lib, - pkgs, - modulesPath, inputs, + lib, + modulesPath, + pkgs, ... }: { imports = [ @@ -14,33 +14,36 @@ inputs.nixos-hardware.nixosModules.framework-13-7040-amd ]; - boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd" "amd-gpu"]; - boot.kernelParams = ["amdgpu.abmlevel=0"]; - boot.extraModulePackages = []; + boot = { + initrd = { + availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"]; + kernelModules = []; + }; - hardware.opengl = { - ## radv: an open-source Vulkan driver from freedesktop - driSupport = true; - driSupport32Bit = true; + extraModulePackages = []; + kernelModules = ["kvm-amd" "amd-gpu"]; + kernelParams = ["amdgpu.abmlevel=0"]; + }; - ## amdvlk: an open-source Vulkan driver from AMD - extraPackages = [pkgs.rocmPackages.clr.icd pkgs.amdvlk]; - extraPackages32 = [pkgs.driversi686Linux.amdvlk]; + hardware = { + cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + enableAllFirmware = true; + + opengl = { + ## radv: an open-source Vulkan driver from freedesktop + driSupport = true; + driSupport32Bit = true; + + ## amdvlk: an open-source Vulkan driver from AMD + extraPackages = [pkgs.rocmPackages.clr.icd pkgs.amdvlk]; + extraPackages32 = [pkgs.driversi686Linux.amdvlk]; + }; }; services.xserver.videoDrivers = ["amdgpu"]; - # 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.enp193s0f3u1c2.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/mandarin/hardware.nix b/hosts/mandarin/hardware.nix index f2b6b610..76996589 100644 --- a/hosts/mandarin/hardware.nix +++ b/hosts/mandarin/hardware.nix @@ -30,16 +30,21 @@ hardware = { cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + enableAllFirmware = true; + nvidia = { modesetting.enable = true; nvidiaSettings = true; package = config.boot.kernelPackages.nvidiaPackages.stable; }; + opengl = { driSupport = true; driSupport32Bit = true; }; }; + services.xserver.videoDrivers = ["nvidia"]; networking.useDHCP = lib.mkDefault true; diff --git a/hosts/mauville/hardware.nix b/hosts/mauville/hardware.nix index d1d5ccff..87b92e41 100644 --- a/hosts/mauville/hardware.nix +++ b/hosts/mauville/hardware.nix @@ -1,9 +1,9 @@ { config, - lib, - pkgs, - modulesPath, inputs, + lib, + modulesPath, + pkgs, ... }: { imports = [ @@ -12,43 +12,55 @@ inputs.nixos-hardware.nixosModules.common-pc-ssd ]; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd" "amdgpu"]; - boot.extraModulePackages = []; + boot = { + initrd = { + availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "sd_mod"]; + kernelModules = []; + }; + + kernelModules = ["kvm-amd" "amdgpu"]; + }; services.xserver = { - # Add AMDGPU driver. - videoDrivers = ["amdgpu"]; + videoDrivers = ["amdgpu"]; # Add AMDGPU driver. }; - hardware.opengl = { - enable = true; - # Add ROCM annd AMD Vulkan driver. - extraPackages = with pkgs; [rocmPackages.clr.icd amdvlk]; - # Add support for 32bit apps. - driSupport32Bit = true; - extraPackages32 = with pkgs; [driversi686Linux.amdvlk]; + hardware = { + cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; + + enableAllFirmware = true; + + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + + extraPackages = with pkgs; [rocmPackages.clr.icd amdvlk]; + extraPackages32 = with pkgs; [driversi686Linux.amdvlk]; + }; }; - fileSystems."/" = { - device = "/dev/disk/by-uuid/c4217c88-3101-434b-8321-58e2ac89527c"; - fsType = "ext4"; - }; + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/c4217c88-3101-434b-8321-58e2ac89527c"; + fsType = "ext4"; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/3445-B2A0"; - fsType = "vfat"; - }; + "/boot" = { + device = "/dev/disk/by-uuid/3445-B2A0"; + fsType = "vfat"; + }; - fileSystems."/mnt/Archive" = { - device = "/dev/disk/by-uuid/f7e9e6d6-2bf6-429a-aaf0-49b55d53fc83"; - fsType = "ext4"; - }; + "/mnt/Archive" = { + device = "/dev/disk/by-uuid/f7e9e6d6-2bf6-429a-aaf0-49b55d53fc83"; + fsType = "ext4"; + }; - fileSystems."/mnt/Media" = { - device = "/dev/disk/by-uuid/d988d5ca-f9d6-4d85-aa0e-8a437b3c859a"; - fsType = "ext4"; + "/mnt/Media" = { + device = "/dev/disk/by-uuid/d988d5ca-f9d6-4d85-aa0e-8a437b3c859a"; + fsType = "ext4"; + }; }; swapDevices = [ @@ -58,14 +70,7 @@ } ]; - # 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.enp4s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/petalburg/hardware.nix b/hosts/petalburg/hardware.nix index c556fce6..1949b962 100644 --- a/hosts/petalburg/hardware.nix +++ b/hosts/petalburg/hardware.nix @@ -1,9 +1,9 @@ { config, - lib, - pkgs, - modulesPath, inputs, + lib, + modulesPath, + pkgs, ... }: { imports = [ @@ -12,45 +12,52 @@ inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd ]; - boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; + boot = { + initrd = { + availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; + kernelModules = []; + }; - # Intel drivers with accelerated video playback support. - nixpkgs.config.packageOverrides = pkgs: { - intel-vaapi-driver = - pkgs.intel-vaapi-driver.override {enableHybridCodec = true;}; + extraModulePackages = []; + kernelModules = ["kvm-intel"]; }; - hardware.opengl = { - enable = true; - extraPackages = with pkgs; [ - intel-media-driver # LIBVA_DRIVER_NAME=iHD - intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) - libvdpau-va-gl - ]; + # Intel drivers with accelerated video playback support. + nixpkgs = { + config.packageOverrides = pkgs: { + intel-vaapi-driver = + pkgs.intel-vaapi-driver.override {enableHybridCodec = true;}; + }; + + hostPlatform = lib.mkDefault "x86_64-linux"; + }; + + hardware = { + cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; + + enableAllFirmware = true; + + opengl = { + enable = true; + + extraPackages = with pkgs; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + libvdpau-va-gl + ]; + }; + + sensor.iio.enable = true; # Enable auto-rotate and tablet mode. }; environment.sessionVariables = { - LIBVA_DRIVER_NAME = "iHD"; - }; # Force intel-media-driver - - # Enable auto-rotate and tablet mode. - hardware.sensor.iio.enable = true; + LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver + }; # Save power/better manage heat & fans. powerManagement.powertop.enable = true; services.thermald.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.wlp0s20f3.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/rustboro/hardware.nix b/hosts/rustboro/hardware.nix index c1116f5e..6fff79f1 100644 --- a/hosts/rustboro/hardware.nix +++ b/hosts/rustboro/hardware.nix @@ -1,9 +1,9 @@ { config, - lib, - pkgs, - modulesPath, inputs, + lib, + modulesPath, + pkgs, ... }: { imports = [ @@ -12,46 +12,56 @@ inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440p ]; - boot.initrd.availableKernelModules = [ - "xhci_pci" - "ehci_pci" - "ahci" - "usb_storage" - "sd_mod" - "sr_mod" - "rtsx_pci_sdmmc" - ]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; + boot = { + initrd = { + availableKernelModules = [ + "xhci_pci" + "ehci_pci" + "ahci" + "usb_storage" + "sd_mod" + "sr_mod" + "rtsx_pci_sdmmc" + ]; + kernelModules = []; + }; - fileSystems."/persist" = {neededForBoot = true;}; + extraModulePackages = []; + kernelModules = ["kvm-intel"]; + }; # Otherwise, CPU doesn't automatically clock down. powerManagement.cpuFreqGovernor = "ondemand"; - # Intel drivers with accelerated video playback support. - nixpkgs.config.packageOverrides = pkgs: { - intel-vaapi-driver = - pkgs.intel-vaapi-driver.override {enableHybridCodec = true;}; - }; + nixpkgs = { + config.packageOverrides = pkgs: { + # Intel drivers with accelerated video playback support. + intel-vaapi-driver = + pkgs.intel-vaapi-driver.override {enableHybridCodec = true;}; + }; - hardware.opengl = { - enable = true; - extraPackages = with pkgs; [ - intel-media-driver # LIBVA_DRIVER_NAME=iHD - intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) - libvdpau-va-gl - ]; + hostPlatform = lib.mkDefault "x86_64-linux"; + }; + hardware = { + cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; + + enableAllFirmware = true; + + opengl = { + enable = true; + + extraPackages = with pkgs; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + libvdpau-va-gl + ]; + }; }; environment.sessionVariables = { - LIBVA_DRIVER_NAME = "iHD"; - }; # Force intel-media-driver + LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver + }; networking.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; }