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, config,
lib,
pkgs,
modulesPath,
inputs, inputs,
lib,
modulesPath,
pkgs,
... ...
}: { }: {
imports = [ imports = [
@ -11,41 +11,50 @@
inputs.nixos-hardware.nixosModules.framework-11th-gen-intel inputs.nixos-hardware.nixosModules.framework-11th-gen-intel
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; boot = {
boot.initrd.kernelModules = []; initrd = {
boot.kernelModules = ["kvm-intel"]; availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"];
boot.extraModulePackages = []; kernelModules = [];
};
# Intel drivers with accelerated video playback support. extraModulePackages = [];
nixpkgs.config.packageOverrides = pkgs: { kernelModules = ["kvm-intel"];
intel-vaapi-driver =
pkgs.intel-vaapi-driver.override {enableHybridCodec = true;};
}; };
hardware.opengl = { # Intel drivers with accelerated video playback support.
enable = true; nixpkgs = {
extraPackages = with pkgs; [ config.packageOverrides = pkgs: {
intel-media-driver # LIBVA_DRIVER_NAME=iHD intel-vaapi-driver =
intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) pkgs.intel-vaapi-driver.override {enableHybridCodec = true;};
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 = { environment.sessionVariables = {
LIBVA_DRIVER_NAME = "iHD"; LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver
}; # Force intel-media-driver };
# Save power/better manage heat & fans. # Save power/better manage heat & fans.
powerManagement.powertop.enable = true; powerManagement.powertop.enable = true;
services.thermald.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.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. # to /etc/nixos/configuration.nix instead.
{ {
config, config,
lib,
pkgs,
modulesPath,
inputs, inputs,
lib,
modulesPath,
pkgs,
... ...
}: { }: {
imports = [ imports = [
@ -14,33 +14,36 @@
inputs.nixos-hardware.nixosModules.framework-13-7040-amd inputs.nixos-hardware.nixosModules.framework-13-7040-amd
]; ];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"]; boot = {
boot.initrd.kernelModules = []; initrd = {
boot.kernelModules = ["kvm-amd" "amd-gpu"]; availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"];
boot.kernelParams = ["amdgpu.abmlevel=0"]; kernelModules = [];
boot.extraModulePackages = []; };
hardware.opengl = { extraModulePackages = [];
## radv: an open-source Vulkan driver from freedesktop kernelModules = ["kvm-amd" "amd-gpu"];
driSupport = true; kernelParams = ["amdgpu.abmlevel=0"];
driSupport32Bit = true; };
## amdvlk: an open-source Vulkan driver from AMD hardware = {
extraPackages = [pkgs.rocmPackages.clr.icd pkgs.amdvlk]; cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
extraPackages32 = [pkgs.driversi686Linux.amdvlk];
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"]; 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.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"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View file

@ -30,16 +30,21 @@
hardware = { hardware = {
cpu.amd.updateMicrocode = cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware; lib.mkDefault config.hardware.enableRedistributableFirmware;
enableAllFirmware = true;
nvidia = { nvidia = {
modesetting.enable = true; modesetting.enable = true;
nvidiaSettings = true; nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable; package = config.boot.kernelPackages.nvidiaPackages.stable;
}; };
opengl = { opengl = {
driSupport = true; driSupport = true;
driSupport32Bit = true; driSupport32Bit = true;
}; };
}; };
services.xserver.videoDrivers = ["nvidia"]; services.xserver.videoDrivers = ["nvidia"];
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;

View file

@ -1,9 +1,9 @@
{ {
config, config,
lib,
pkgs,
modulesPath,
inputs, inputs,
lib,
modulesPath,
pkgs,
... ...
}: { }: {
imports = [ imports = [
@ -12,43 +12,55 @@
inputs.nixos-hardware.nixosModules.common-pc-ssd inputs.nixos-hardware.nixosModules.common-pc-ssd
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "sd_mod"]; boot = {
boot.initrd.kernelModules = []; initrd = {
boot.kernelModules = ["kvm-amd" "amdgpu"]; availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "sd_mod"];
boot.extraModulePackages = []; kernelModules = [];
};
kernelModules = ["kvm-amd" "amdgpu"];
};
services.xserver = { services.xserver = {
# Add AMDGPU driver. videoDrivers = ["amdgpu"]; # Add AMDGPU driver.
videoDrivers = ["amdgpu"];
}; };
hardware.opengl = { hardware = {
enable = true; cpu.amd.updateMicrocode =
# Add ROCM annd AMD Vulkan driver. lib.mkDefault config.hardware.enableRedistributableFirmware;
extraPackages = with pkgs; [rocmPackages.clr.icd amdvlk];
# Add support for 32bit apps. enableAllFirmware = true;
driSupport32Bit = true;
extraPackages32 = with pkgs; [driversi686Linux.amdvlk]; opengl = {
enable = true;
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"; device = "/dev/disk/by-uuid/c4217c88-3101-434b-8321-58e2ac89527c";
}; fsType = "ext4";
};
fileSystems."/boot" = { "/boot" = {
device = "/dev/disk/by-uuid/3445-B2A0"; device = "/dev/disk/by-uuid/3445-B2A0";
fsType = "vfat"; fsType = "vfat";
}; };
fileSystems."/mnt/Archive" = { "/mnt/Archive" = {
device = "/dev/disk/by-uuid/f7e9e6d6-2bf6-429a-aaf0-49b55d53fc83"; device = "/dev/disk/by-uuid/f7e9e6d6-2bf6-429a-aaf0-49b55d53fc83";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/mnt/Media" = { "/mnt/Media" = {
device = "/dev/disk/by-uuid/d988d5ca-f9d6-4d85-aa0e-8a437b3c859a"; device = "/dev/disk/by-uuid/d988d5ca-f9d6-4d85-aa0e-8a437b3c859a";
fsType = "ext4"; fsType = "ext4";
};
}; };
swapDevices = [ 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.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View file

@ -1,9 +1,9 @@
{ {
config, config,
lib,
pkgs,
modulesPath,
inputs, inputs,
lib,
modulesPath,
pkgs,
... ...
}: { }: {
imports = [ imports = [
@ -12,45 +12,52 @@
inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; boot = {
boot.initrd.kernelModules = []; initrd = {
boot.kernelModules = ["kvm-intel"]; availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"];
boot.extraModulePackages = []; kernelModules = [];
};
# Intel drivers with accelerated video playback support. extraModulePackages = [];
nixpkgs.config.packageOverrides = pkgs: { kernelModules = ["kvm-intel"];
intel-vaapi-driver =
pkgs.intel-vaapi-driver.override {enableHybridCodec = true;};
}; };
hardware.opengl = { # Intel drivers with accelerated video playback support.
enable = true; nixpkgs = {
extraPackages = with pkgs; [ config.packageOverrides = pkgs: {
intel-media-driver # LIBVA_DRIVER_NAME=iHD intel-vaapi-driver =
intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) pkgs.intel-vaapi-driver.override {enableHybridCodec = true;};
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
];
};
sensor.iio.enable = true; # Enable auto-rotate and tablet mode.
}; };
environment.sessionVariables = { environment.sessionVariables = {
LIBVA_DRIVER_NAME = "iHD"; LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver
}; # Force intel-media-driver };
# Enable auto-rotate and tablet mode.
hardware.sensor.iio.enable = true;
# Save power/better manage heat & fans. # Save power/better manage heat & fans.
powerManagement.powertop.enable = true; powerManagement.powertop.enable = true;
services.thermald.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.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, config,
lib,
pkgs,
modulesPath,
inputs, inputs,
lib,
modulesPath,
pkgs,
... ...
}: { }: {
imports = [ imports = [
@ -12,46 +12,56 @@
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440p inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440p
]; ];
boot.initrd.availableKernelModules = [ boot = {
"xhci_pci" initrd = {
"ehci_pci" availableKernelModules = [
"ahci" "xhci_pci"
"usb_storage" "ehci_pci"
"sd_mod" "ahci"
"sr_mod" "usb_storage"
"rtsx_pci_sdmmc" "sd_mod"
]; "sr_mod"
boot.initrd.kernelModules = []; "rtsx_pci_sdmmc"
boot.kernelModules = ["kvm-intel"]; ];
boot.extraModulePackages = []; kernelModules = [];
};
fileSystems."/persist" = {neededForBoot = true;}; extraModulePackages = [];
kernelModules = ["kvm-intel"];
};
# Otherwise, CPU doesn't automatically clock down. # Otherwise, CPU doesn't automatically clock down.
powerManagement.cpuFreqGovernor = "ondemand"; powerManagement.cpuFreqGovernor = "ondemand";
# Intel drivers with accelerated video playback support. nixpkgs = {
nixpkgs.config.packageOverrides = pkgs: { config.packageOverrides = pkgs: {
intel-vaapi-driver = # Intel drivers with accelerated video playback support.
pkgs.intel-vaapi-driver.override {enableHybridCodec = true;}; intel-vaapi-driver =
}; pkgs.intel-vaapi-driver.override {enableHybridCodec = true;};
};
hardware.opengl = { hostPlatform = lib.mkDefault "x86_64-linux";
enable = true; };
extraPackages = with pkgs; [ hardware = {
intel-media-driver # LIBVA_DRIVER_NAME=iHD cpu.intel.updateMicrocode =
intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) lib.mkDefault config.hardware.enableRedistributableFirmware;
libvdpau-va-gl
]; 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 = { environment.sessionVariables = {
LIBVA_DRIVER_NAME = "iHD"; LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver
}; # Force intel-media-driver };
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }