diff --git a/flake.lock b/flake.lock index 2623e55..4f3e796 100644 --- a/flake.lock +++ b/flake.lock @@ -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" } }, diff --git a/flake.nix b/flake.nix index d1ecc26..0b59a8f 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = { diff --git a/misc/2-monitor.conf b/misc/2-monitor.conf index 78441a7..e18ab5b 100644 --- a/misc/2-monitor.conf +++ b/misc/2-monitor.conf @@ -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 - diff --git a/systems/gerg-desktop/default.nix b/systems/gerg-desktop/default.nix index 8c40ec4..a81f967 100644 --- a/systems/gerg-desktop/default.nix +++ b/systems/gerg-desktop/default.nix @@ -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"; diff --git a/systems/gerg-desktop/vfio.nix b/systems/gerg-desktop/vfio.nix index 2e61957..d43886d 100644 --- a/systems/gerg-desktop/vfio.nix +++ b/systems/gerg-desktop/vfio.nix @@ -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 '';