nixos-config/modules/hardware.nix

69 lines
1.8 KiB
Nix
Raw Normal View History

2019-08-27 23:41:02 +04:00
{ pkgs, config, lib, ... }:
with rec {
inherit (config) device devices deviceSpecific;
};
with deviceSpecific; {
hardware.cpu.${devices.${device}.cpu.vendor}.updateMicrocode = true; # Update microcode
2019-09-14 22:12:56 +04:00
hardware.enableRedistributableFirmware = true; # For some unfree drivers
2019-08-27 23:41:02 +04:00
2019-09-17 02:26:38 +04:00
# Enable hardware video acceleration for Intel
2019-09-14 22:12:56 +04:00
nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
};
2019-09-17 02:26:38 +04:00
boot.initrd.kernelModules = if video == "intel" then [ "iHD" ] else [ ];
2020-08-15 19:36:16 +04:00
# boot.initrd.kernelModules = if video == "intel" then [ "i915" ] else [ ];
2019-09-14 22:12:56 +04:00
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = if video == "intel" then [
2020-08-15 19:36:16 +04:00
# pkgs.vaapiIntel
# pkgs.vaapiVdpau
# pkgs.libvdpau-va-gl
2019-09-14 22:12:56 +04:00
pkgs.intel-media-driver
] else [ ];
};
2019-09-17 02:26:38 +04:00
environment.sessionVariables = {
GST_VAAPI_ALL_DRIVERS = "1";
LIBVA_DRIVER_NAME = "iHD";
};
2019-09-16 15:01:24 +04:00
# --- END ---
2019-08-27 23:41:02 +04:00
2020-08-15 19:36:16 +04:00
# hardware.bluetooth.enable = isLaptop;
2019-08-27 23:41:02 +04:00
2019-09-17 16:48:43 +04:00
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
2019-08-27 23:41:02 +04:00
};
2019-09-17 16:48:43 +04:00
boot.kernelPackages = if isVM then
pkgs.linuxPackages
else
pkgs.linuxPackages_latest;
boot.supportedFilesystems = [ "ntfs" ];
boot.blacklistedKernelModules = lib.mkIf (device == "Dell-Laptop") [
"psmouse"
];
2020-03-21 01:42:50 +04:00
# boot.kernelParams = lib.mkIf (device == "Dell-Laptop") [
# "mem_sleep_default=deep"
# ];
2019-08-27 23:41:02 +04:00
boot.extraModprobeConfig = lib.mkIf (device == "AMD-Workstation") ''
options snd slots=snd_virtuoso,snd_usb_audio
'';
2019-09-14 22:12:56 +04:00
# SSD Section
boot.kernel.sysctl = {
"vm.swappiness" = if isSSD then 1 else 10;
};
services.fstrim = {
enable = isSSD;
interval = "weekly";
};
2019-09-18 01:59:22 +04:00
services.fwupd.enable = (device == "Dell-Laptop");
2019-12-13 23:14:40 +04:00
services.udev.packages = [ pkgs.stlink ];
2019-09-18 01:59:22 +04:00
2019-08-27 23:41:02 +04:00
}