diff --git a/flake.nix b/flake.nix index 14359b7..291804b 100644 --- a/flake.nix +++ b/flake.nix @@ -89,7 +89,7 @@ }; my-overlays = [ overlay-stable - overlay-vaapiIntel + # overlay-vaapiIntel overlay-nitrokey-udev-update ]; inherit (inputs.nix-cfg-extra.lib) extra-data; diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 7657685..e8a7cb0 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -111,12 +111,12 @@ in hardware.graphics = { enable = true; # These extrapackages I added later but it didn't help - extraPackages = with pkgs; [ - intel-media-driver # LIBVA_DRIVER_NAME=iHD - vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) - vaapiVdpau - libvdpau-va-gl - ]; + # extraPackages = with pkgs; [ + # intel-media-driver # LIBVA_DRIVER_NAME=iHD + # vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + # vaapiVdpau + # libvdpau-va-gl + # ]; }; # Tell Xorg to use the nvidia driver (also valid for Wayland) services.xserver.videoDrivers = ["nvidia"]; @@ -126,7 +126,7 @@ in modesetting.enable = true; # Use the open source version of the kernel module # Only available on driver 515.43.04+ - open = false; + open = true; # Enable the nvidia settings menu nvidiaSettings = true; powerManagement.enable = true; @@ -136,7 +136,7 @@ in }; # NVIDIA - hardware.nvidia.prime = { + hardware.nvidia.prime = lib.mkIf (config.specialisation != {}) { offload = { enable = true; enableOffloadCmd = true; @@ -147,13 +147,33 @@ in nvidiaBusId = "PCI:1:0:0"; }; + specialisation."dGPU-only".configuration = { + environment.etc."specialisation".text = "dGPU-only"; + system.nixos.tags = ["dGPU-only"]; + # hardware.nvidia.prime = { + # offload.enable = lib.mkForce false; + # offload.enableOffloadCmd = lib.mkForce false; + # sync.enable = lib.mkForce true; + # }; + environment.systemPackages = [ + (pkgs.writeShellScriptBin "nvidia-offload" '' + echo "nvidia full mode on, simply executing $@" + exec "$@" + '') + ]; + # boot.kernelParams = [ "module_blacklist=i915" ]; + }; + specialisation."nvidia-full".configuration = { environment.etc."specialisation".text = "nvidia-full"; system.nixos.tags = ["nvidia-full"]; hardware.nvidia.prime = { - offload.enable = lib.mkForce false; - offload.enableOffloadCmd = lib.mkForce false; - sync.enable = lib.mkForce true; + offload.enable = false; + offload.enableOffloadCmd = false; + sync.enable = true; + + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; }; environment.systemPackages = [ (pkgs.writeShellScriptBin "nvidia-offload" '' diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix index 5138656..bb94530 100644 --- a/hosts/laptop/hardware-configuration.nix +++ b/hosts/laptop/hardware-configuration.nix @@ -16,7 +16,7 @@ in boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "ahci" "nvme" "usbhid" "uas" "usb_storage" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.kernelModules = [ "kvm-intel" ]; - boot.kernelParams = [ "i915.enable_psr=0" "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ]; + boot.kernelParams = [ "i915.enable_psr=0" ]; boot.extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; fileSystems."/" =