mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 00:43:56 -05:00
testing nvidia prime offloading
This commit is contained in:
parent
ee95fa7ead
commit
70d19cb60f
5 changed files with 32 additions and 16 deletions
8
flake.lock
generated
8
flake.lock
generated
|
|
@ -218,17 +218,17 @@
|
|||
"nixpkgs-regression": "nixpkgs-regression"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677045134,
|
||||
"narHash": "sha256-jUc2ccTR8f6MGY2pUKgujm+lxSPNGm/ZAP+toX+nMNc=",
|
||||
"lastModified": 1677713084,
|
||||
"narHash": "sha256-5aCmGZbsFcLIckCDfvnPD4clGPQI7qYAqHYlttN/Wkg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nix",
|
||||
"rev": "4acc684ef7b3117c6d6ac12837398a0008a53d85",
|
||||
"rev": "70d01bdec1f9e2d9deba8198e99f2ad0a663d08c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "latest-release",
|
||||
"repo": "nix",
|
||||
"rev": "70d01bdec1f9e2d9deba8198e99f2ad0a663d08c",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
master.url = "github:NixOS/nixpkgs";
|
||||
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
stable.url = "github:NixOS/nixpkgs/nixos-22.11";
|
||||
#nix
|
||||
nix.url = "github:NixOS/nix/latest-release";
|
||||
#nix 2.14
|
||||
nix.url = "github:NixOS/nix/70d01bdec1f9e2d9deba8198e99f2ad0a663d08c";
|
||||
#utilites --maybe flake-parts soon?
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixos-generators = {
|
||||
|
|
|
|||
|
|
@ -35,28 +35,33 @@ EndSection
|
|||
|
||||
Section "ServerLayout"
|
||||
Identifier "Layout[all]"
|
||||
Screen "Screen-nvidia[0]"
|
||||
Inactive "Device-amdgpu[0]"
|
||||
Option "AllowNVIDIAGPUScreens"
|
||||
|
||||
Screen "Screen-amdgpu[0]"
|
||||
EndSection
|
||||
|
||||
|
||||
Section "Device"
|
||||
Identifier "Device-amdgpu[0]"
|
||||
Driver "amdgpu"
|
||||
|
||||
BusID "PCI:15:0:0"
|
||||
|
||||
EndSection
|
||||
|
||||
Section "Screen"
|
||||
Identifier "Screen-amdgpu[0]"
|
||||
Device "Device-amdgpu[0]"
|
||||
|
||||
EndSection
|
||||
|
||||
|
||||
Section "Device"
|
||||
Identifier "Device-nvidia[0]"
|
||||
Driver "nvidia"
|
||||
|
||||
BusID "PCI:1:0:0"
|
||||
EndSection
|
||||
|
||||
Section "Screen"
|
||||
Identifier "Screen-nvidia[0]"
|
||||
Device "Device-nvidia[0]"
|
||||
EndSection
|
||||
|
||||
|
||||
|
|
@ -64,4 +69,3 @@ EndSection
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ inputs: {
|
|||
services.xserver = {
|
||||
videoDrivers = ["nvidia" "amdgpu"];
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
environment.systemPackages = [
|
||||
|
|
@ -65,6 +66,13 @@ inputs: {
|
|||
wrapProgram "$out/bin/webcord" --run 'rm $HOME/.config/WebCord/windowState.json'
|
||||
'';
|
||||
})
|
||||
(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 "$@"
|
||||
'')
|
||||
];
|
||||
|
||||
environment.etc."xdg/alacritty/alacritty.yml".source = "${self}/misc/alacritty.yml";
|
||||
|
|
|
|||
|
|
@ -74,12 +74,16 @@ in {
|
|||
|
||||
users.users."${settings.username}".extraGroups = ["kvm" "libvirtd"];
|
||||
|
||||
#xrandr --setprovideroutputsource "AMD Radeon Graphics @ pci:0000:0f:00.0" NVIDIA-0
|
||||
#xrandr --output DP-0 --mode 3440x1440 --rate 120 --primary --pos 0x0
|
||||
#xrandr --output HDMI-A-1-0 --mode 1920x1080 --rate 144 --set TearFree on --pos 3440x360
|
||||
#xset -dpms
|
||||
#prime sync
|
||||
services.xserver.displayManager.xserverArgs = lib.mkAfter ["-config /tmp/xorg.conf"];
|
||||
services.xserver.displayManager.sessionCommands = lib.mkBefore ''
|
||||
if ! (test -e "/tmp/ONE_MONITOR"); then
|
||||
xrandr --setprovideroutputsource "AMD Radeon Graphics @ pci:0000:0f:00.0" NVIDIA-0
|
||||
xrandr --output DP-0 --mode 3440x1440 --rate 120 --primary --pos 0x0
|
||||
xrandr --output HDMI-A-1-0 --mode 1920x1080 --rate 144 --set TearFree on --pos 3440x360
|
||||
xrandr --output DP-1-0 --auto --mode 3440x1440 --rate 120 --primary --pos 0x0
|
||||
xrandr --output HDMI-A-0 --auto --mode 1920x1080 --rate 144 --set TearFree on --pos 3440x360
|
||||
xset -dpms
|
||||
fi
|
||||
'';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue