reorganized hardware files and enabled firmware

This commit is contained in:
Aly Raffauf 2024-06-14 21:18:00 -04:00
parent 56823c5c11
commit 08d98ade6f
6 changed files with 194 additions and 155 deletions

View file

@ -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 = [];
};
extraModulePackages = [];
kernelModules = ["kvm-intel"];
};
# Intel drivers with accelerated video playback support.
nixpkgs.config.packageOverrides = pkgs: {
nixpkgs = {
config.packageOverrides = pkgs: {
intel-vaapi-driver =
pkgs.intel-vaapi-driver.override {enableHybridCodec = true;};
};
hardware.opengl = {
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.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -3,10 +3,10 @@
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
inputs,
lib,
modulesPath,
pkgs,
...
}: {
imports = [
@ -14,13 +14,23 @@
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 = {
extraModulePackages = [];
kernelModules = ["kvm-amd" "amd-gpu"];
kernelParams = ["amdgpu.abmlevel=0"];
};
hardware = {
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
enableAllFirmware = true;
opengl = {
## radv: an open-source Vulkan driver from freedesktop
driSupport = true;
driSupport32Bit = true;
@ -29,18 +39,11 @@
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.<interface>.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;
}

View file

@ -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;

View file

@ -1,9 +1,9 @@
{
config,
lib,
pkgs,
modulesPath,
inputs,
lib,
modulesPath,
pkgs,
...
}: {
imports = [
@ -12,44 +12,56 @@
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 = {
hardware = {
cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
enableAllFirmware = true;
opengl = {
enable = true;
# Add ROCM annd AMD Vulkan driver.
extraPackages = with pkgs; [rocmPackages.clr.icd amdvlk];
# Add support for 32bit apps.
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [rocmPackages.clr.icd amdvlk];
extraPackages32 = with pkgs; [driversi686Linux.amdvlk];
};
};
fileSystems."/" = {
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/c4217c88-3101-434b-8321-58e2ac89527c";
fsType = "ext4";
};
fileSystems."/boot" = {
"/boot" = {
device = "/dev/disk/by-uuid/3445-B2A0";
fsType = "vfat";
};
fileSystems."/mnt/Archive" = {
"/mnt/Archive" = {
device = "/dev/disk/by-uuid/f7e9e6d6-2bf6-429a-aaf0-49b55d53fc83";
fsType = "ext4";
};
fileSystems."/mnt/Media" = {
"/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.<interface>.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;
}

View file

@ -1,9 +1,9 @@
{
config,
lib,
pkgs,
modulesPath,
inputs,
lib,
modulesPath,
pkgs,
...
}: {
imports = [
@ -12,19 +12,35 @@
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 = [];
};
extraModulePackages = [];
kernelModules = ["kvm-intel"];
};
# Intel drivers with accelerated video playback support.
nixpkgs.config.packageOverrides = pkgs: {
nixpkgs = {
config.packageOverrides = pkgs: {
intel-vaapi-driver =
pkgs.intel-vaapi-driver.override {enableHybridCodec = true;};
};
hardware.opengl = {
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)
@ -32,25 +48,16 @@
];
};
environment.sessionVariables = {
LIBVA_DRIVER_NAME = "iHD";
}; # Force intel-media-driver
sensor.iio.enable = true; # Enable auto-rotate and tablet mode.
};
# Enable auto-rotate and tablet mode.
hardware.sensor.iio.enable = true;
environment.sessionVariables = {
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.<interface>.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;
}

View file

@ -1,9 +1,9 @@
{
config,
lib,
pkgs,
modulesPath,
inputs,
lib,
modulesPath,
pkgs,
...
}: {
imports = [
@ -12,7 +12,9 @@
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440p
];
boot.initrd.availableKernelModules = [
boot = {
initrd = {
availableKernelModules = [
"xhci_pci"
"ehci_pci"
"ahci"
@ -21,37 +23,45 @@
"sr_mod"
"rtsx_pci_sdmmc"
];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
kernelModules = [];
};
fileSystems."/persist" = {neededForBoot = true;};
extraModulePackages = [];
kernelModules = ["kvm-intel"];
};
# Otherwise, CPU doesn't automatically clock down.
powerManagement.cpuFreqGovernor = "ondemand";
nixpkgs = {
config.packageOverrides = pkgs: {
# Intel drivers with accelerated video playback support.
nixpkgs.config.packageOverrides = pkgs: {
intel-vaapi-driver =
pkgs.intel-vaapi-driver.override {enableHybridCodec = true;};
};
hardware.opengl = {
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;
}