Skip to content

Instantly share code, notes, and snippets.

@cyber-murmel
Last active February 28, 2024 21:23
Show Gist options
  • Save cyber-murmel/e3aba1c1ff5e19f1d270a2a471d7198b to your computer and use it in GitHub Desktop.
Save cyber-murmel/e3aba1c1ff5e19f1d270a2a471d7198b to your computer and use it in GitHub Desktop.
Nixos Hardware Config fo TUXEDO InfinityBook Pro 14 - Gen7 (MK1)
{ config, pkgs, lib, ... }:
let
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec "$@"
'';
in
{
boot = {
extraModprobeConfig = ''
options i915 force_probe=46a6
'';
};
services.xserver.videoDrivers = [
"nvidia"
];
hardware = {
opengl.enable = true;
nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.stable;
modesetting.enable = true;
powerManagement.enable = true;
prime = {
offload.enable = true;
# Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
intelBusId = "PCI:0:2:0";
# Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
nvidiaBusId = "PCI:1:0:0";
};
};
};
environment.systemPackages = with pkgs; [
nvidia-offload
glxinfo
];
# TODO: fix hang on boot
specialisation = {
external-display.configuration = {
system.nixos.tags = [ "external-display" ];
hardware.nvidia.prime.offload.enable = lib.mkForce false;
hardware.nvidia.powerManagement.enable = lib.mkForce false;
};
};
}
@erkkimon
Copy link

Thank you! This saved me lots of headache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment