From 6ffcdbacc5eabcdde6af04efeefa55872667c134 Mon Sep 17 00:00:00 2001 From: bahaynes Date: Wed, 22 Jul 2020 17:16:27 -0400 Subject: [PATCH 1/5] Added dell xps 15-9500, with nvidia gpu. --- README.md | 2 + dell/xps/15-9500/README.wiki | 14 ++ dell/xps/15-9500/default.nix | 10 ++ dell/xps/15-9500/nvidia/default.nix | 31 +++++ dell/xps/15-9500/thermald-conf.xml | 205 ++++++++++++++++++++++++++++ dell/xps/15-9500/xps-common.nix | 24 ++++ flake.nix | 2 + 7 files changed, 288 insertions(+) create mode 100644 dell/xps/15-9500/README.wiki create mode 100644 dell/xps/15-9500/default.nix create mode 100644 dell/xps/15-9500/nvidia/default.nix create mode 100644 dell/xps/15-9500/thermald-conf.xml create mode 100644 dell/xps/15-9500/xps-common.nix diff --git a/README.md b/README.md index 2fd5193..f1a2113 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ See code for all available configurations. | [Dell XPS 15 9560][] | `` | | [Dell XPS 15 9560, intel only][] | `` | | [Dell XPS 15 9560, nvidia only][] | `` | +| [Dell XPS 15 9500][] | `` | +| [Dell XPS 15 9500, nvidia][] | `` | | [Google Pixelbook][] | `` | | [Inverse Path USB armory][] | `` | | Lenovo IdeaPad Z510 | `` | diff --git a/dell/xps/15-9500/README.wiki b/dell/xps/15-9500/README.wiki new file mode 100644 index 0000000..d2e0456 --- /dev/null +++ b/dell/xps/15-9500/README.wiki @@ -0,0 +1,14 @@ += Dell XPS 15 9550 = + +== Tested Hardware == + +* CPU: Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz +* RAM: 64 GB +* HDD: 1 TiB SSD +* Screen: 15" 4k (3840✕2160) +* Graphics: NVIDIA Corporation TU117M [GeForce GTX 1650 Ti Mobile], with Intel Graphics too. +* Input: Touchscreen and trackpad. + +== Notes == + +Also tested with Dell WD19TB Thunderbolt Dock. diff --git a/dell/xps/15-9500/default.nix b/dell/xps/15-9500/default.nix new file mode 100644 index 0000000..8d6d15b --- /dev/null +++ b/dell/xps/15-9500/default.nix @@ -0,0 +1,10 @@ +{ lib, pkgs, ... }: + +{ + imports = [ + ./xps-common.nix + ]; + + # This configuration makes intel default + services.xserver.videoDrivers = lib.mkDefault [ "intel" ]; +} diff --git a/dell/xps/15-9500/nvidia/default.nix b/dell/xps/15-9500/nvidia/default.nix new file mode 100644 index 0000000..b7150c1 --- /dev/null +++ b/dell/xps/15-9500/nvidia/default.nix @@ -0,0 +1,31 @@ +{ lib, pkgs, ... }: + +# This creates a new 'nvidia-offload' program that runs the application passed to it on the GPU +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 -a "$0" "$@" + ''; +in +{ + imports = [ + ../xps-common.nix + ]; + + # As per https://nixos.wiki/wiki/Nvidia + services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ]; + environment.systemPackages = [ nvidia-offload ]; + + hardware.nvidia.prime = { + offload.enable = lib.mkDefault true; + + # Bus ID of the Intel GPU. + intelBusId = lib.mkDefault "PCI:0:2:0"; + + # Bus ID of the NVIDIA GPU. + nvidiaBusId = lib.mkDefault "PCI:1:0:0"; + }; +} diff --git a/dell/xps/15-9500/thermald-conf.xml b/dell/xps/15-9500/thermald-conf.xml new file mode 100644 index 0000000..bc13d35 --- /dev/null +++ b/dell/xps/15-9500/thermald-conf.xml @@ -0,0 +1,205 @@ + + + + + Auto generated + XPS 15 9500 + QUIET + + 0 + 10000 + 68000 + 56000 + 56000 + 250 + + + + auto_zone_0 + + + SEN2 + 55000 + Passive + + B0D4 + 1 + 45000000 + + + + SEN2 + 57000 + Passive + + B0D4 + 1 + 40000000 + + + + SEN2 + 60000 + Passive + + B0D4 + 1 + 35000000 + + + + SEN2 + 64000 + Passive + + B0D4 + 3 + 35000000 + + + + SEN2 + 68000 + Passive + + B0D4 + 3 + 20000000 + + + + SEN2 + 70000 + Passive + + B0D4 + 3 + 15000000 + + + + + + auto_zone_1 + + + SEN5 + 38000 + Passive + + B0D4 + 1 + 22000000 + + + + SEN5 + 39000 + Passive + + B0D4 + 1 + 17000000 + + + + SEN5 + 40000 + Passive + + B0D4 + 3 + 12000000 + + + + SEN5 + 41000 + Passive + + B0D4 + 3 + + + + + + auto_zone_2 + + + VIR1 + 57000 + Passive + + B0D4 + 3 + 15000000 + + + + VIR1 + 60000 + Passive + + B0D4 + 3 + + + + + + auto_zone_3 + + + VIR2 + 76000 + Passive + + B0D4 + 1 + + + + + + auto_zone_4 + + + WRLS + 80000 + Passive + + B0D4 + 1 + + + + + + auto_zone_5 + + + STG1 + 66000 + Passive + + B0D4 + 1 + 19000000 + + + + STG1 + 90000 + Passive + + B0D4 + 1 + + + + + + + + diff --git a/dell/xps/15-9500/xps-common.nix b/dell/xps/15-9500/xps-common.nix new file mode 100644 index 0000000..afa627d --- /dev/null +++ b/dell/xps/15-9500/xps-common.nix @@ -0,0 +1,24 @@ +{ lib, ... }: +let + thermald-conf = ./thermald-conf.xml; +in +{ + imports = [ + ../../../common/cpu/intel + ../../../common/pc/laptop + ../../../common/pc/laptop/ssd + ]; + + # Boot loader + boot.kernelParams = lib.mkDefault [ "acpi_rev_override" ]; + + # This will save you money and possibly your life! + services.thermald.enable = lib.mkDefault true; + + # Thermald doesn't have a default config for the 9500 yet, the one in this repo was generated with dptfxtract-static: + services.thermald.configFile = lib.mkDefault thermald-conf; + + # Set the tlp config to powersave explictly (this should be default). TLP is enabled in common/pc/laptop. + services.tlp.extraConfig = lib.mkDefault "CPU_SCALING_GOVERNOR_ON_AC=powersave\nCPU_SCALING_GOVERNOR_ON_BAT=powersave"; + +} diff --git a/flake.nix b/flake.nix index c30d3c9..b6e6718 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,8 @@ dell-xps-15-9560 = import ./dell/xps/15-9560; dell-xps-15-9560-intel = import ./dell/xps/15-9560/intel; dell-xps-15-9560-nvidia = import ./dell/xps/15-9560/nvidia; + dell-xps-15-9500 = import ./dell/xps/15-9500; + dell-xps-15-9500-nvidia = import ./dell/xps/15-9500/nvidia; google-pixelbook = import ./google/pixelbook; inversepath-usbarmory = import ./inversepath/usbarmory; lenovo-ideapad-z510 = import ./lenovo/ideapad/z510; From b7a5f1188f1a0ddd53fd18aa610c4834be212e8a Mon Sep 17 00:00:00 2001 From: bahaynes Date: Sat, 25 Jul 2020 23:53:47 -0400 Subject: [PATCH 2/5] Moved NVIDIA config to common, and updated README. --- common/gpu/nvidia.nix | 22 ++++++++++++++++++++++ dell/xps/15-9500/README.wiki | 8 ++++++++ dell/xps/15-9500/nvidia/default.nix | 18 +----------------- dell/xps/15-9500/xps-common.nix | 6 +++--- 4 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 common/gpu/nvidia.nix diff --git a/common/gpu/nvidia.nix b/common/gpu/nvidia.nix new file mode 100644 index 0000000..fed9fa9 --- /dev/null +++ b/common/gpu/nvidia.nix @@ -0,0 +1,22 @@ +{ lib, pkgs, ... }: + +# This creates a new 'nvidia-offload' program that runs the application passed to it on the GPU +# As per https://nixos.wiki/wiki/Nvidia +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 -a "$0" "$@" + ''; +in +{ + services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ]; + environment.systemPackages = [ nvidia-offload ]; + + hardware.nvidia.prime = { + offload.enable = lib.mkDefault true; + # Hardware should specify the bus ID for intel/nvidia devices + }; +} diff --git a/dell/xps/15-9500/README.wiki b/dell/xps/15-9500/README.wiki index d2e0456..ebcb5e3 100644 --- a/dell/xps/15-9500/README.wiki +++ b/dell/xps/15-9500/README.wiki @@ -12,3 +12,11 @@ == Notes == Also tested with Dell WD19TB Thunderbolt Dock. + +== NVIDIA Offload == + +In order to run a program on the NVIDIA gpu, you can use the `nvidia-offload` function, for example: +``` +nvidia-offload `nix-shell -p glxinfo --run 'glxgears'` +``` +This is a short bash script that sets the proper environment variables and calls your command. diff --git a/dell/xps/15-9500/nvidia/default.nix b/dell/xps/15-9500/nvidia/default.nix index b7150c1..75d5d73 100644 --- a/dell/xps/15-9500/nvidia/default.nix +++ b/dell/xps/15-9500/nvidia/default.nix @@ -1,27 +1,11 @@ { lib, pkgs, ... }: - -# This creates a new 'nvidia-offload' program that runs the application passed to it on the GPU -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 -a "$0" "$@" - ''; -in { imports = [ ../xps-common.nix + ../../../../common/gpu/nvidia.nix ]; - # As per https://nixos.wiki/wiki/Nvidia - services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ]; - environment.systemPackages = [ nvidia-offload ]; - hardware.nvidia.prime = { - offload.enable = lib.mkDefault true; - # Bus ID of the Intel GPU. intelBusId = lib.mkDefault "PCI:0:2:0"; diff --git a/dell/xps/15-9500/xps-common.nix b/dell/xps/15-9500/xps-common.nix index afa627d..7cec13c 100644 --- a/dell/xps/15-9500/xps-common.nix +++ b/dell/xps/15-9500/xps-common.nix @@ -15,10 +15,10 @@ in # This will save you money and possibly your life! services.thermald.enable = lib.mkDefault true; - # Thermald doesn't have a default config for the 9500 yet, the one in this repo was generated with dptfxtract-static: + # Thermald doesn't have a default config for the 9500 yet, the one in this repo + # was generated with dptfxtract-static (https://github.com/intel/dptfxtract) services.thermald.configFile = lib.mkDefault thermald-conf; - # Set the tlp config to powersave explictly (this should be default). TLP is enabled in common/pc/laptop. + # Set the tlp config to powersave explictly. TLP is enabled in common/pc/laptop. services.tlp.extraConfig = lib.mkDefault "CPU_SCALING_GOVERNOR_ON_AC=powersave\nCPU_SCALING_GOVERNOR_ON_BAT=powersave"; - } From 8e984dc856b714fe319cf9e27ce79ce3b7b751a6 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 27 Jul 2020 10:11:53 -0400 Subject: [PATCH 3/5] Update dell/xps/15-9500/default.nix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update intel drivers to default (Modesetting). Co-authored-by: Jörg Thalheim --- dell/xps/15-9500/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/dell/xps/15-9500/default.nix b/dell/xps/15-9500/default.nix index 8d6d15b..26827c3 100644 --- a/dell/xps/15-9500/default.nix +++ b/dell/xps/15-9500/default.nix @@ -5,6 +5,4 @@ ./xps-common.nix ]; - # This configuration makes intel default - services.xserver.videoDrivers = lib.mkDefault [ "intel" ]; } From d56b2e96a67a0de915838f47a6c355af83a62163 Mon Sep 17 00:00:00 2001 From: bahaynes Date: Mon, 27 Jul 2020 13:00:20 -0400 Subject: [PATCH 4/5] Updated default (non-NVIDIA) config. Removed xps-common, and migrated it to default.nix. --- dell/xps/15-9500/default.nix | 22 +++++++++++++++++++--- dell/xps/15-9500/nvidia/default.nix | 2 +- dell/xps/15-9500/xps-common.nix | 24 ------------------------ 3 files changed, 20 insertions(+), 28 deletions(-) delete mode 100644 dell/xps/15-9500/xps-common.nix diff --git a/dell/xps/15-9500/default.nix b/dell/xps/15-9500/default.nix index 26827c3..7cec13c 100644 --- a/dell/xps/15-9500/default.nix +++ b/dell/xps/15-9500/default.nix @@ -1,8 +1,24 @@ -{ lib, pkgs, ... }: - +{ lib, ... }: +let + thermald-conf = ./thermald-conf.xml; +in { imports = [ - ./xps-common.nix + ../../../common/cpu/intel + ../../../common/pc/laptop + ../../../common/pc/laptop/ssd ]; + # Boot loader + boot.kernelParams = lib.mkDefault [ "acpi_rev_override" ]; + + # This will save you money and possibly your life! + services.thermald.enable = lib.mkDefault true; + + # Thermald doesn't have a default config for the 9500 yet, the one in this repo + # was generated with dptfxtract-static (https://github.com/intel/dptfxtract) + services.thermald.configFile = lib.mkDefault thermald-conf; + + # Set the tlp config to powersave explictly. TLP is enabled in common/pc/laptop. + services.tlp.extraConfig = lib.mkDefault "CPU_SCALING_GOVERNOR_ON_AC=powersave\nCPU_SCALING_GOVERNOR_ON_BAT=powersave"; } diff --git a/dell/xps/15-9500/nvidia/default.nix b/dell/xps/15-9500/nvidia/default.nix index 75d5d73..451b6eb 100644 --- a/dell/xps/15-9500/nvidia/default.nix +++ b/dell/xps/15-9500/nvidia/default.nix @@ -1,7 +1,7 @@ { lib, pkgs, ... }: { imports = [ - ../xps-common.nix + ../default.nix ../../../../common/gpu/nvidia.nix ]; diff --git a/dell/xps/15-9500/xps-common.nix b/dell/xps/15-9500/xps-common.nix deleted file mode 100644 index 7cec13c..0000000 --- a/dell/xps/15-9500/xps-common.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ lib, ... }: -let - thermald-conf = ./thermald-conf.xml; -in -{ - imports = [ - ../../../common/cpu/intel - ../../../common/pc/laptop - ../../../common/pc/laptop/ssd - ]; - - # Boot loader - boot.kernelParams = lib.mkDefault [ "acpi_rev_override" ]; - - # This will save you money and possibly your life! - services.thermald.enable = lib.mkDefault true; - - # Thermald doesn't have a default config for the 9500 yet, the one in this repo - # was generated with dptfxtract-static (https://github.com/intel/dptfxtract) - services.thermald.configFile = lib.mkDefault thermald-conf; - - # Set the tlp config to powersave explictly. TLP is enabled in common/pc/laptop. - services.tlp.extraConfig = lib.mkDefault "CPU_SCALING_GOVERNOR_ON_AC=powersave\nCPU_SCALING_GOVERNOR_ON_BAT=powersave"; -} From cc72f59d5a405ee2e812944e5ebab06f0ed18475 Mon Sep 17 00:00:00 2001 From: bahaynes Date: Wed, 29 Jul 2020 20:51:08 -0400 Subject: [PATCH 5/5] Removed tlp configuration. Should be set correctly after https://github.com/NixOS/nixpkgs/pull/94064 is merged. --- dell/xps/15-9500/default.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/dell/xps/15-9500/default.nix b/dell/xps/15-9500/default.nix index 7cec13c..c7beda4 100644 --- a/dell/xps/15-9500/default.nix +++ b/dell/xps/15-9500/default.nix @@ -18,7 +18,4 @@ in # Thermald doesn't have a default config for the 9500 yet, the one in this repo # was generated with dptfxtract-static (https://github.com/intel/dptfxtract) services.thermald.configFile = lib.mkDefault thermald-conf; - - # Set the tlp config to powersave explictly. TLP is enabled in common/pc/laptop. - services.tlp.extraConfig = lib.mkDefault "CPU_SCALING_GOVERNOR_ON_AC=powersave\nCPU_SCALING_GOVERNOR_ON_BAT=powersave"; }