From 7d42994f2106a761f8c772cd75a7033339f3b35b Mon Sep 17 00:00:00 2001 From: materus Date: Thu, 2 May 2024 10:15:29 +0200 Subject: [PATCH] Old-materusPC: use nvidia gpu for steam and browser --- .../Old-materusPC/home/materus/default.nix | 48 ++++++++++++++++++- configurations/host/Old-materusPC/nvidia.nix | 4 ++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/configurations/host/Old-materusPC/home/materus/default.nix b/configurations/host/Old-materusPC/home/materus/default.nix index 946a26c..61242a0 100644 --- a/configurations/host/Old-materusPC/home/materus/default.nix +++ b/configurations/host/Old-materusPC/home/materus/default.nix @@ -71,7 +71,53 @@ editor.emacs.enable = false; }; - + xdg.desktopEntries.brave-browser = let env = lib.concatStringsSep " " [ + ''VK_ICD_FILENAMES=''$VK_ICD_FILENAMES:/run/opengl-driver/share/vulkan/icd.d/nvidia_icd.x86_64.json:/run/opengl-driver-32/share/vulkan/icd.d/nvidia_icd.i686.json'' + ''__NV_PRIME_RENDER_OFFLOAD="1"'' + ''__NV_PRIME_RENDER_OFFLOAD_PROVIDER="NVIDIA-G0"'' + ''__GLX_VENDOR_LIBRARY_NAME="nvidia"'' + ''__VK_LAYER_NV_optimus="NVIDIA_only"'' + ]; + script = pkgs.writeShellScript "brave" '' + ${env} brave "$@" + ''; + + in + { + name = "Brave Web Browser"; + genericName = "PrzeglÄ…darka WWW"; + comment = "Skorzystaj z internetu"; + exec = "${script} %U"; + icon = "brave-browser"; + terminal = false; + categories = [ "Application" "Network" "WebBrowser" ]; + mimeType = [ + "application/pdf" + "application/rdf+xml" + "application/rss+xml" + "application/xhtml+xml" + "application/xhtml_xml" + "application/xml" + "image/gif" + "image/jpeg" + "image/png" + "image/webp" + "text/html" + "text/xml" + "x-scheme-handler/http" + "x-scheme-handler/https" + "x-scheme-handler/ipfs" + "x-scheme-handler/ipns" + ]; + actions.new-windows = { + exec = "${script}"; + name = "Nowe okno"; + }; + actions.new-private-windows = { + exec = "${script} --incognito"; + name = "Nowe okno incognito"; + }; + }; home.packages = [ pkgs.papirus-icon-theme (materusArg.pkgs.polymc.wrap { extraJDKs = [ pkgs.graalvm-ce ]; }) diff --git a/configurations/host/Old-materusPC/nvidia.nix b/configurations/host/Old-materusPC/nvidia.nix index 3263ac8..1b7651e 100644 --- a/configurations/host/Old-materusPC/nvidia.nix +++ b/configurations/host/Old-materusPC/nvidia.nix @@ -28,5 +28,9 @@ ]; materus.profile.steam.extraEnv = { VK_ICD_FILENAMES=''''$VK_ICD_FILENAMES:/run/opengl-driver/share/vulkan/icd.d/nvidia_icd.x86_64.json:/run/opengl-driver-32/share/vulkan/icd.d/nvidia_icd.i686.json''; + __NV_PRIME_RENDER_OFFLOAD="1"; + __NV_PRIME_RENDER_OFFLOAD_PROVIDER="NVIDIA-G0"; + __GLX_VENDOR_LIBRARY_NAME="nvidia"; + __VK_LAYER_NV_optimus="NVIDIA_only"; }; }