porcorosso: set up PRIME so we can draw to my laptop's internal display!
This commit is contained in:
parent
1348172aba
commit
4b2c0f7fa8
4 changed files with 62 additions and 9 deletions
|
@ -33,7 +33,7 @@ in {
|
|||
"sd_mod"
|
||||
"rtsx_pci_sdmmc"
|
||||
];
|
||||
boot.blacklistedKernelModules = [ "i2c_nvidia_gpu" ];
|
||||
boot.initrd.kernelModules = [ "nvidia" "nvidia_uvm" "nvidia_drm" "nvidia_modeset" "i2c_nvidia_gpu" ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.supportedFilesystems = [ "ntfs" ];
|
||||
boot.kernel.sysctl = {
|
||||
|
@ -159,6 +159,9 @@ in {
|
|||
specialisation.intelGraphics.configuration = {
|
||||
my.specialisationName = "intelGraphics";
|
||||
services.xserver.videoDrivers = lib.mkForce [ "intel" ];
|
||||
hardware.nvidia.modesetting.enable = lib.mkForce false;
|
||||
hardware.nvidia.prime.offload.enable = lib.mkForce false;
|
||||
boot.initrd.kernelModules = lib.mkForce [];
|
||||
};
|
||||
services.xserver.displayManager.gdm = {
|
||||
enable = true;
|
||||
|
@ -166,6 +169,16 @@ in {
|
|||
nvidiaWayland = false;
|
||||
};
|
||||
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
prime = {
|
||||
# PRIME sync enables using Intel non-muxed outputs (i.e. the internal display)
|
||||
sync.enable = true;
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
intelBusId = "PCI:0:2:0";
|
||||
};
|
||||
};
|
||||
|
||||
hardware.opengl.driSupport32Bit = true;
|
||||
hardware.opengl.extraPackages = with pkgs; [
|
||||
intel-media-driver vaapiVdpau libvdpau-va-gl libva
|
||||
|
@ -191,32 +204,46 @@ in {
|
|||
extraGroups = [ "wheel" "networkmanager" "libvirtd" "lxd" "video" ];
|
||||
};
|
||||
my.home-manager.system = {...}: {
|
||||
xsession.windowManager.i3.config.startup = lib.mkAfter [
|
||||
{ command = "${pkgs.autorandr}/bin/autorandr -c"; notification = false; }
|
||||
xsession.windowManager.i3.config.startup = let
|
||||
setupDisplay = pkgs.writeShellScriptBin "setup-display-porcorosso" ''
|
||||
${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0
|
||||
${pkgs.xorg.xrandr}/bin/xrandr --auto
|
||||
${pkgs.autorandr}/bin/autorandr -c
|
||||
'';
|
||||
in lib.mkAfter [
|
||||
{ command = "${setupDisplay}/bin/setup-display-porcorosso"; notification = false; }
|
||||
];
|
||||
programs.autorandr = {
|
||||
enable = true;
|
||||
profiles.standard = {
|
||||
config = {
|
||||
"eDP-1-1" = {
|
||||
enable = true;
|
||||
mode = "1920x1080";
|
||||
position = "0x0";
|
||||
rate = "59.98";
|
||||
crtc = 4;
|
||||
};
|
||||
"DP-0.2" = {
|
||||
enable = true;
|
||||
mode = "3840x2160";
|
||||
primary = true;
|
||||
position = "0x0";
|
||||
position = "1920x0";
|
||||
rate = "60.00";
|
||||
crtc = 0;
|
||||
crtc = 1;
|
||||
};
|
||||
"DP-0.1" = {
|
||||
enable = true;
|
||||
mode = "3840x2160";
|
||||
position = "3840x0";
|
||||
position = "5760x0";
|
||||
rate = "60.00";
|
||||
crtc = 1;
|
||||
crtc = 0;
|
||||
};
|
||||
};
|
||||
fingerprint = {
|
||||
"DP-0.2" = "00ffffffffffff0005e36828e70100001b180104a53e22783aeed1a555489b26125054bfef00d1c0b30095008180814081c001010101e5ca0038f0703e8018108a006d552100001a04740030f2705a80b0588a006d552100001a000000fd0017501ea03c010a202020202020000000fc0055323836380a20202020202020014d020326f14b0103051404131f1202119023090707830100006d030c00100000782000600102038c0ad08a20e02d10103e96006d5521000018011d007251d01e206e2855006d552100001e8c0ad08a20e02d10103e96006d55210000188c0ad090204031200c4055006d5521000018000000000000000000000000000000000013";
|
||||
"DP-0.1" = "00ffffffffffff0005e368283302000016180104a53e22783aeed1a555489b26125054bfef00d1c0b30095008180814081c001010101e5ca0038f0703e8018108a006d552100001a04740030f2705a80b0588a006d552100001a000000fd0017501ea03c010a202020202020000000fc0055323836380a202020202020200105020326f14b0103051404131f1202119023090707830100006d030c00100000782000600102038c0ad08a20e02d10103e96006d5521000018011d007251d01e206e2855006d552100001e8c0ad08a20e02d10103e96006d55210000188c0ad090204031200c4055006d5521000018000000000000000000000000000000000013";
|
||||
"DP-0.1" = "00ffffffffffff0005e368283302000016180104a53e22783aeed1a555489b26125054bfef00d1c0b30095008180814081c00101010125cc0050f0703e8018108a006d552100001a04740030f2705a80b0588a006d552100001a000000fd0017501ea03c010a202020202020000000fc0055323836380a2020202020202001ab020326f14b0103051404131f1202119023090707830100006d030c00100000782000600102038c0ad08a20e02d10103e96006d5521000018011d007251d01e206e2855006d552100001e8c0ad08a20e02d10103e96006d55210000188c0ad090204031200c4055006d5521000018000000000000000000000000000000000013";
|
||||
"eDP-1-1" = "00ffffffffffff0030e41a0600000000001c0104a522137802e0b5a3544e9b260c505400000001010101010101010101010101010101243680a070381f403020350058c21000001a502b80a070381f403020350058c21000001a000000fe003150564d35803135365746430a00000000000141319e001000000a010a2020007a";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -260,6 +260,7 @@ in
|
|||
BusID "${pCfg.nvidiaBusId}"
|
||||
${optionalString syncCfg.allowExternalGpu "Option \"AllowExternalGpus\""}
|
||||
${optionalString cfg.powerManagement.finegrained "Option \"NVreg_DynamicPowerManagement=0x02\""}
|
||||
Option "SidebandSocketPath" "/run/nvidia-xdriver"
|
||||
'';
|
||||
screenSection =
|
||||
''
|
||||
|
@ -340,7 +341,9 @@ in
|
|||
systemd.tmpfiles.rules = optional config.virtualisation.docker.enableNvidia
|
||||
"L+ /run/nvidia-docker/bin - - - - ${nvidia_x11.bin}/origBin"
|
||||
++ optional (nvidia_x11.persistenced != null && config.virtualisation.docker.enableNvidia)
|
||||
"L+ /run/nvidia-docker/extras/bin/nvidia-persistenced - - - - ${nvidia_x11.persistenced}/origBin/nvidia-persistenced";
|
||||
"L+ /run/nvidia-docker/extras/bin/nvidia-persistenced - - - - ${nvidia_x11.persistenced}/origBin/nvidia-persistenced"
|
||||
++ optional primeEnabled
|
||||
"d /run/nvidia-xdriver 0770 root video";
|
||||
|
||||
boot.extraModulePackages = [ nvidia_x11.bin ];
|
||||
|
||||
|
|
22
third_party/nixpkgs/patches/nvidia-sideband-socket.patch
vendored
Normal file
22
third_party/nixpkgs/patches/nvidia-sideband-socket.patch
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix
|
||||
--- a/nixos/modules/hardware/video/nvidia.nix
|
||||
+++ b/nixos/modules/hardware/video/nvidia.nix
|
||||
@@ -260,6 +260,7 @@ in
|
||||
BusID "${pCfg.nvidiaBusId}"
|
||||
${optionalString syncCfg.allowExternalGpu "Option \"AllowExternalGpus\""}
|
||||
${optionalString cfg.powerManagement.finegrained "Option \"NVreg_DynamicPowerManagement=0x02\""}
|
||||
+ Option "SidebandSocketPath" "/run/nvidia-xdriver"
|
||||
'';
|
||||
screenSection =
|
||||
''
|
||||
@@ -340,7 +341,9 @@ in
|
||||
systemd.tmpfiles.rules = optional config.virtualisation.docker.enableNvidia
|
||||
"L+ /run/nvidia-docker/bin - - - - ${nvidia_x11.bin}/origBin"
|
||||
++ optional (nvidia_x11.persistenced != null && config.virtualisation.docker.enableNvidia)
|
||||
- "L+ /run/nvidia-docker/extras/bin/nvidia-persistenced - - - - ${nvidia_x11.persistenced}/origBin/nvidia-persistenced";
|
||||
+ "L+ /run/nvidia-docker/extras/bin/nvidia-persistenced - - - - ${nvidia_x11.persistenced}/origBin/nvidia-persistenced"
|
||||
+ ++ optional primeEnabled
|
||||
+ "d /run/nvidia-xdriver 0770 root video";
|
||||
|
||||
boot.extraModulePackages = [ nvidia_x11.bin ];
|
||||
|
1
third_party/nixpkgs/patches/series
vendored
1
third_party/nixpkgs/patches/series
vendored
|
@ -4,3 +4,4 @@ pomerium-fix2.patch
|
|||
pr153718.patch
|
||||
pr153998.patch
|
||||
pr154021.patch
|
||||
nvidia-sideband-socket.patch
|
||||
|
|
Loading…
Reference in a new issue