about summary refs log tree commit diff
path: root/modules/nixos-hardware/dell/xps
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nixos-hardware/dell/xps')
-rw-r--r--modules/nixos-hardware/dell/xps/13-7390/README.wiki16
-rw-r--r--modules/nixos-hardware/dell/xps/13-7390/default.nix17
-rw-r--r--modules/nixos-hardware/dell/xps/13-9343/default.nix12
-rw-r--r--modules/nixos-hardware/dell/xps/13-9360/default.nix19
-rw-r--r--modules/nixos-hardware/dell/xps/13-9370/README.wiki16
-rw-r--r--modules/nixos-hardware/dell/xps/13-9370/default.nix20
-rw-r--r--modules/nixos-hardware/dell/xps/13-9380/README.wiki20
-rw-r--r--modules/nixos-hardware/dell/xps/13-9380/default.nix18
-rw-r--r--modules/nixos-hardware/dell/xps/15-7590/README.wiki54
-rw-r--r--modules/nixos-hardware/dell/xps/15-7590/default.nix51
-rw-r--r--modules/nixos-hardware/dell/xps/15-9500/README.wiki22
-rw-r--r--modules/nixos-hardware/dell/xps/15-9500/default.nix21
-rw-r--r--modules/nixos-hardware/dell/xps/15-9500/nvidia/default.nix15
-rw-r--r--modules/nixos-hardware/dell/xps/15-9500/thermald-conf.xml205
-rw-r--r--modules/nixos-hardware/dell/xps/15-9550/README.wiki59
-rw-r--r--modules/nixos-hardware/dell/xps/15-9550/default.nix18
-rw-r--r--modules/nixos-hardware/dell/xps/15-9550/nvidia/default.nix15
-rw-r--r--modules/nixos-hardware/dell/xps/15-9560/README.wiki54
-rw-r--r--modules/nixos-hardware/dell/xps/15-9560/default.nix24
-rw-r--r--modules/nixos-hardware/dell/xps/15-9560/intel/default.nix18
-rw-r--r--modules/nixos-hardware/dell/xps/15-9560/nvidia/default.nix20
-rw-r--r--modules/nixos-hardware/dell/xps/15-9560/xps-common.nix12
22 files changed, 726 insertions, 0 deletions
diff --git a/modules/nixos-hardware/dell/xps/13-7390/README.wiki b/modules/nixos-hardware/dell/xps/13-7390/README.wiki
new file mode 100644
index 000000000000..6ec37d0f4476
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/13-7390/README.wiki
@@ -0,0 +1,16 @@
+= Dell XPS 13 7390 =
+
+== Installation == 
+
+You need to disable RAID and use AHCI instead as described [https://wiki.ubuntu.com/Dell/XPS/XPS-13-7390-2-in-1 here].
+
+== Firmware upgrades ==
+
+Note that this device is supported by [https://fwupd.org/ fwupd].
+To perform firmware upgrades just activate the service
+
+<code>
+services.fwupd.enable = true;
+</code>
+
+Then use <code>fwupdmgr</code> to perform updates.
diff --git a/modules/nixos-hardware/dell/xps/13-7390/default.nix b/modules/nixos-hardware/dell/xps/13-7390/default.nix
new file mode 100644
index 000000000000..1aa0c4bcd3dd
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/13-7390/default.nix
@@ -0,0 +1,17 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop
+    ../../../common/pc/laptop/ssd
+  ];
+
+  boot.kernelParams = [ "mem_sleep_default=deep" ];
+
+  # older version break wifi:
+  # - https://github.com/NixOS/nixos-hardware/issues/173
+  boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.6") pkgs.linuxPackages_latest;
+
+  services.thermald.enable = true;
+}
diff --git a/modules/nixos-hardware/dell/xps/13-9343/default.nix b/modules/nixos-hardware/dell/xps/13-9343/default.nix
new file mode 100644
index 000000000000..2904a773c7b4
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/13-9343/default.nix
@@ -0,0 +1,12 @@
+{ lib, ... }:
+
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop
+    ../../../common/pc/laptop/ssd
+  ];
+
+  # This will save you money and possibly your life!
+  services.thermald.enable = lib.mkDefault true;
+}
diff --git a/modules/nixos-hardware/dell/xps/13-9360/default.nix b/modules/nixos-hardware/dell/xps/13-9360/default.nix
new file mode 100644
index 000000000000..68eedc8c57f5
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/13-9360/default.nix
@@ -0,0 +1,19 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../../common/cpu/intel/kaby-lake
+    ../../../common/pc/laptop
+  ];
+
+  boot.blacklistedKernelModules = [ "psmouse" ]; # touchpad goes over i2c
+
+  # TODO: decide on boot loader policy
+  boot.loader = {
+    efi.canTouchEfiVariables = lib.mkDefault true;
+    systemd-boot.enable = lib.mkDefault true;
+  };
+
+  # This will save you money and possibly your life!
+  services.thermald.enable = true;
+}
diff --git a/modules/nixos-hardware/dell/xps/13-9370/README.wiki b/modules/nixos-hardware/dell/xps/13-9370/README.wiki
new file mode 100644
index 000000000000..57b5e08d3850
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/13-9370/README.wiki
@@ -0,0 +1,16 @@
+= Dell XPS 13 9370 =
+
+== Battery drain when sleeping ==
+
+The laptop uses the S2 sleep mode by default instead of S3, which leads to
+draining a lot of battery during sleep.
+
+Though this is intentional by the manufacturer and might cause lockups when
+forced  I - @moredread - never had any issues with it.
+
+See https://wiki.archlinux.org/index.php/Dell_XPS_13_(9370)#Power_Management
+and https://bugzilla.kernel.org/show_bug.cgi?id=199689#c3 for reference
+
+== Additional resources ==
+
+* Arch linux wiki: [https://wiki.archlinux.org/index.php/Dell_XPS_13_(9370) Dell XPS 13 9370]
diff --git a/modules/nixos-hardware/dell/xps/13-9370/default.nix b/modules/nixos-hardware/dell/xps/13-9370/default.nix
new file mode 100644
index 000000000000..dbe852f0c27f
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/13-9370/default.nix
@@ -0,0 +1,20 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../../common/cpu/intel/kaby-lake
+    ../../../common/pc/laptop
+    ../../../common/pc/laptop/acpi_call.nix
+  ];
+
+  # Force S3 sleep mode. See README.wiki for details.
+  boot.kernelParams = [ "mem_sleep_default=deep" ];
+
+  # touchpad goes over i2c
+  boot.blacklistedKernelModules = [ "psmouse" ];
+
+  services.throttled.enable = lib.mkDefault true;
+
+  # This will save you money and possibly your life!
+  services.thermald.enable = true;
+}
diff --git a/modules/nixos-hardware/dell/xps/13-9380/README.wiki b/modules/nixos-hardware/dell/xps/13-9380/README.wiki
new file mode 100644
index 000000000000..c5ad61e3fd63
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/13-9380/README.wiki
@@ -0,0 +1,20 @@
+= Dell XPS 13 9380 =
+
+== Firmware upgrades ==
+
+Note that this device is supported by [https://fwupd.org/ fwupd].
+To perform firmware upgrades just activate the service
+
+<code>
+services.fwupd.enable = true;
+</code>
+
+Then use <code>fwupdmgr</code> to perform updates.
+
+== Battery drain when sleeping ==
+
+The laptop uses the S2 sleep mode by default instead of S3, which leads to
+draining a lot of battery during sleep.
+
+See https://wiki.archlinux.org/index.php/Dell_XPS_13_(9370)#Power_Management
+and https://bugzilla.kernel.org/show_bug.cgi?id=199689#c3 for reference
diff --git a/modules/nixos-hardware/dell/xps/13-9380/default.nix b/modules/nixos-hardware/dell/xps/13-9380/default.nix
new file mode 100644
index 000000000000..162cc2618eb1
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/13-9380/default.nix
@@ -0,0 +1,18 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop
+    ../../../common/pc/laptop/acpi_call.nix
+  ];
+
+  # Force S3 sleep mode. See README.wiki for details.
+  boot.kernelParams = [ "mem_sleep_default=deep" ];
+
+  # touchpad goes over i2c
+  boot.blacklistedKernelModules = [ "psmouse" ];
+
+  # This will save you money and possibly your life!
+  services.thermald.enable = true;
+}
diff --git a/modules/nixos-hardware/dell/xps/15-7590/README.wiki b/modules/nixos-hardware/dell/xps/15-7590/README.wiki
new file mode 100644
index 000000000000..052df2911f1b
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-7590/README.wiki
@@ -0,0 +1,54 @@
+= Dell XPS 15 7590 =
+*Mostly copied from 15-9550
+
+== Tested Hardware ==
+
+* CPU: Intel(R) Core(TM) i9-9980HK
+* RAM: 32 GB
+* HDD: 1 TiB SSD
+* Screen: 15" 4k (3840✕2160)
+* Input: Touchscreen and trackpad.
+
+== Firmware Configuration ==
+
+Not much tweaking of NixOS itself was needed. But we currently cannot automate the firmware setup, so this must be done by hand.
+
+=== Before installation ===
+
+These settings are needed both for booting the final install, and installer itself. Therefore, they must be done first.
+
+* ''Disable Secure Boot (but keep UEFI Boot).'' Thankfully doing so is as easy as changing any other simple setting.
+
+* ''Disable Intel hardware RAID and use AHCI instead.'' Intel doesn't seem to provide a working linux driver for this.  (If you just have SSD it's pointless and just slows things down needlessly anyways.)
+
+=== Wifi ===
+~~Wifi does not work with kernels older than 5.1 (firmware not present) or newer~~ (https://bbs.archlinux.org/viewtopic.php?id=247705)
+
+Update: The 48.ucode causes the Killer wifi card to crash. The iwlfwifi-cc-a0-46.ucode works perfectly. 
+default.nix contains an overlay that removes the offending ucode from the linux-firmware bundle.
+To use it one also needs to enable unfree firmware in their own configuration (<code>hardware.enableRedistributableFirmware = true;</code>)
+
+```
+  # Use the systemd-boot EFI boot loader.
+  boot.loader.systemd-boot.enable = true;
+  boot.loader.grub = {
+    device = "nodev";
+    efiSupport = true;
+    efiInstallAsRemovable = true;
+  };
+  boot.loader.efi.canTouchEfiVariables = true;
+  boot.kernelPackages = pkgs.linuxPackages_5_1;
+```
+Disable the `canTouchEfiVariables` after a boot or two to prevent NVRAM wearout.
+
+
+=== After installation ===
+
+* ''Add systemd-boot to UEFI boot list.'' The (uneditable anyways) settings mapping drive UUIDs to HD* work fine.
+
+=== Optional ===
+
+* ''Update BIOS.'' According to Reddit, this helps with battery life.
+
+=== Troubleshooting ===
+
diff --git a/modules/nixos-hardware/dell/xps/15-7590/default.nix b/modules/nixos-hardware/dell/xps/15-7590/default.nix
new file mode 100644
index 000000000000..eeb69e204ee9
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-7590/default.nix
@@ -0,0 +1,51 @@
+{ lib, ... }:
+# Earlier font-size setup.
+# Virtual console options were renamed in 20.03; use the right option depending
+# on the OS version; keep this here at least until 20.03 is stable.
+lib.recursiveUpdate
+(if lib.versionAtLeast (lib.versions.majorMinor lib.version) "20.03" then {
+  console.earlySetup = true;
+} else {
+  boot.earlyVconsoleSetup = true;
+}) {
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop
+    ../../../common/pc/ssd
+  ];
+
+  # Set to true for just the first run, then disable it.
+  # boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
+
+  # Load GPU drivers.
+  # hardware.bumblebee.enable = lib.mkDefault true;
+
+  # High DPI for X users. 175 "looks reasonable" but I didn't do the actual DPI
+  # calculation.
+  # services.xserver.dpi = lib.mkDefault 175;
+
+  # Earlier font-size setup
+  console.earlySetup = true;
+
+  # Prevent small EFI partiion from filling up
+  boot.loader.grub.configurationLimit = 10;
+
+  # The 48.ucode causes the Killer wifi card to crash.
+  # The iwlfwifi-cc-a0-46.ucode works perfectly
+  nixpkgs.overlays = [
+    (self: super: {
+      firmwareLinuxNonfree = super.firmwareLinuxNonfree.overrideAttrs (old: {
+        src = super.fetchgit {
+          url =
+            "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
+          rev = "bf13a71b18af229b4c900b321ef1f8443028ded8";
+          sha256 = "1dcaqdqyffxiadx420pg20157wqidz0c0ca5mrgyfxgrbh6a4mdj";
+        };
+        postInstall = ''
+          rm $out/lib/firmware/iwlwifi-cc-a0-48.ucode
+        '';
+        outputHash = "0dq48i1cr8f0qx3nyq50l9w9915vhgpwmwiw3b4yhisbc3afyay4";
+      });
+    })
+  ];
+}
diff --git a/modules/nixos-hardware/dell/xps/15-9500/README.wiki b/modules/nixos-hardware/dell/xps/15-9500/README.wiki
new file mode 100644
index 000000000000..ebcb5e315396
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9500/README.wiki
@@ -0,0 +1,22 @@
+= 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.
+
+== 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/modules/nixos-hardware/dell/xps/15-9500/default.nix b/modules/nixos-hardware/dell/xps/15-9500/default.nix
new file mode 100644
index 000000000000..c7beda4d558e
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9500/default.nix
@@ -0,0 +1,21 @@
+{ 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;
+}
diff --git a/modules/nixos-hardware/dell/xps/15-9500/nvidia/default.nix b/modules/nixos-hardware/dell/xps/15-9500/nvidia/default.nix
new file mode 100644
index 000000000000..451b6eb75315
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9500/nvidia/default.nix
@@ -0,0 +1,15 @@
+{ lib, pkgs, ... }:
+{
+  imports = [
+    ../default.nix
+    ../../../../common/gpu/nvidia.nix
+  ];
+
+  hardware.nvidia.prime = {
+    # 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/modules/nixos-hardware/dell/xps/15-9500/thermald-conf.xml b/modules/nixos-hardware/dell/xps/15-9500/thermald-conf.xml
new file mode 100644
index 000000000000..bc13d3541dcb
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9500/thermald-conf.xml
@@ -0,0 +1,205 @@
+<?xml version="1.0"?> 
+ <!-- BEGIN --> 
+ <ThermalConfiguration> 
+ <Platform>
+	<Name> Auto generated </Name>
+	<ProductName>XPS 15 9500</ProductName>
+	<Preference>QUIET</Preference>
+	<PPCC>
+		<PowerLimitIndex>0</PowerLimitIndex>
+		<PowerLimitMinimum>10000</PowerLimitMinimum>
+		<PowerLimitMaximum>68000</PowerLimitMaximum>
+		<TimeWindowMinimum>56000</TimeWindowMinimum>
+		<TimeWindowMaximum>56000</TimeWindowMaximum>
+		<StepSize>250</StepSize>
+	</PPCC>
+	<ThermalZones>
+		<ThermalZone>
+			<Type>auto_zone_0</Type>
+			<TripPoints>
+				<TripPoint>
+					<SensorType>SEN2</SensorType>
+					<Temperature>55000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>1</SamplingPeriod>
+						<TargetState>45000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+				<TripPoint>
+					<SensorType>SEN2</SensorType>
+					<Temperature>57000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>1</SamplingPeriod>
+						<TargetState>40000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+				<TripPoint>
+					<SensorType>SEN2</SensorType>
+					<Temperature>60000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>1</SamplingPeriod>
+						<TargetState>35000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+				<TripPoint>
+					<SensorType>SEN2</SensorType>
+					<Temperature>64000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>3</SamplingPeriod>
+						<TargetState>35000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+				<TripPoint>
+					<SensorType>SEN2</SensorType>
+					<Temperature>68000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>3</SamplingPeriod>
+						<TargetState>20000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+				<TripPoint>
+					<SensorType>SEN2</SensorType>
+					<Temperature>70000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>3</SamplingPeriod>
+						<TargetState>15000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+			</TripPoints>
+		</ThermalZone>
+		<ThermalZone>
+			<Type>auto_zone_1</Type>
+			<TripPoints>
+				<TripPoint>
+					<SensorType>SEN5</SensorType>
+					<Temperature>38000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>1</SamplingPeriod>
+						<TargetState>22000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+				<TripPoint>
+					<SensorType>SEN5</SensorType>
+					<Temperature>39000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>1</SamplingPeriod>
+						<TargetState>17000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+				<TripPoint>
+					<SensorType>SEN5</SensorType>
+					<Temperature>40000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>3</SamplingPeriod>
+						<TargetState>12000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+				<TripPoint>
+					<SensorType>SEN5</SensorType>
+					<Temperature>41000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>3</SamplingPeriod>
+					</CoolingDevice>
+				</TripPoint>
+			</TripPoints>
+		</ThermalZone>
+		<ThermalZone>
+			<Type>auto_zone_2</Type>
+			<TripPoints>
+				<TripPoint>
+					<SensorType>VIR1</SensorType>
+					<Temperature>57000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>3</SamplingPeriod>
+						<TargetState>15000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+				<TripPoint>
+					<SensorType>VIR1</SensorType>
+					<Temperature>60000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>3</SamplingPeriod>
+					</CoolingDevice>
+				</TripPoint>
+			</TripPoints>
+		</ThermalZone>
+		<ThermalZone>
+			<Type>auto_zone_3</Type>
+			<TripPoints>
+				<TripPoint>
+					<SensorType>VIR2</SensorType>
+					<Temperature>76000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>1</SamplingPeriod>
+					</CoolingDevice>
+				</TripPoint>
+			</TripPoints>
+		</ThermalZone>
+		<ThermalZone>
+			<Type>auto_zone_4</Type>
+			<TripPoints>
+				<TripPoint>
+					<SensorType>WRLS</SensorType>
+					<Temperature>80000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>1</SamplingPeriod>
+					</CoolingDevice>
+				</TripPoint>
+			</TripPoints>
+		</ThermalZone>
+		<ThermalZone>
+			<Type>auto_zone_5</Type>
+			<TripPoints>
+				<TripPoint>
+					<SensorType>STG1</SensorType>
+					<Temperature>66000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>1</SamplingPeriod>
+						<TargetState>19000000</TargetState>
+					</CoolingDevice>
+				</TripPoint>
+				<TripPoint>
+					<SensorType>STG1</SensorType>
+					<Temperature>90000</Temperature>
+					<Type>Passive</Type>
+					<CoolingDevice>
+						<Type>B0D4</Type>
+						<SamplingPeriod>1</SamplingPeriod>
+					</CoolingDevice>
+				</TripPoint>
+			</TripPoints>
+		</ThermalZone>
+	</ThermalZones>
+</Platform>
+</ThermalConfiguration>
+<!-- END -->
diff --git a/modules/nixos-hardware/dell/xps/15-9550/README.wiki b/modules/nixos-hardware/dell/xps/15-9550/README.wiki
new file mode 100644
index 000000000000..93d33ab9c6f7
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9550/README.wiki
@@ -0,0 +1,59 @@
+= Dell XPS 15 9550 =
+
+Most of this I presume also applies to the XPS 13 1530, the 13" variant.
+
+== Tested Hardware ==
+
+* CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
+* RAM: 32 GB
+* HDD: 512 GiB SSD
+* Screen: 15" 4k (3840✕2160)
+* Graphics: NVIDIA Corporation GM107M, with Intel Graphics too.
+* Input: Touchscreen and trackpad.
+
+== 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.
+
+== Firmware Configuration ==
+
+Not much tweaking of NixOS itself was needed. But we currently cannot automate the firmware setup, so this must be done by hand.
+
+=== Before installation ===
+
+These settings are needed both for booting the final install, and installer itself. Therefore, they must be done first.
+
+* ''Disable Secure Boot (but keep UEFI Boot).'' Thakfully doing so is as easy as changing any other simple setting.
+
+* ''Disable Intel hardware RAID and use AHCI instead.'' Intel doesn't seem to provide a working linux driver for this.  (If you just have SSD it's pointless and just slows things down needlessly anyways.)
+
+
+=== After installation ===
+
+* ''Add systemd-boot to UEFI boot list.'' The (uneditable anyways) settings mapping drive UUIDs to HD* work fine.
+
+=== Optional ===
+
+* ''Disable C-States.'' This is a processor idling thing. It seems to cause random crashes (Blank screen, no normal panic debug dump). Unfortunately, without it, the computer cannot be suspended. On the other hand, it doesn't seem to affect acpi's estimation of battery life when the computer is running with minimal load, but I haven't tested battery life in practice. I list it as optional as there's a tradeoff, and the crashes are rare enough one can probably get through installation just fine.
+
+* ''Update BIOS.'' According to Reddit, this helps with battery life.
+
+* ''Update Intel's Thunderbolt firmware.'' Without this, the Thunderbolt port will only work as power source, and not transfer data.
+
+=== Troubleshooting ===
+
+==== rcu_sched freezing problems ====
+
+After a recent update my machine became unstable. X couldn't start and even running `lspci` would lock the machine. I'm not sure what the root cause was, but I found the fix here: https://wiki.archlinux.org/index.php/Dell_XPS_15_9560#Troubleshooting
+
+TL;DR I added this line:
+
+```
+boot.kernelParams = [ "acpi_rev_override=1" "pcie_aspm=off" "nouveau.modeset=0" ];
+```
+
+Some more detail about the problem can be found here: https://bbs.archlinux.org/viewtopic.php?id=223056
diff --git a/modules/nixos-hardware/dell/xps/15-9550/default.nix b/modules/nixos-hardware/dell/xps/15-9550/default.nix
new file mode 100644
index 000000000000..9677972a6b70
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9550/default.nix
@@ -0,0 +1,18 @@
+{ lib, ... }:
+
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop
+  ];
+
+  # TODO: boot loader
+  boot.loader.systemd-boot.enable = lib.mkDefault true;
+  boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
+
+  # This will save you money and possibly your life!
+  services.thermald.enable = true;
+
+  # To just use Intel integrated graphics with Intel's open source driver
+  # hardware.nvidiaOptimus.disable = true;
+}
diff --git a/modules/nixos-hardware/dell/xps/15-9550/nvidia/default.nix b/modules/nixos-hardware/dell/xps/15-9550/nvidia/default.nix
new file mode 100644
index 000000000000..451b6eb75315
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9550/nvidia/default.nix
@@ -0,0 +1,15 @@
+{ lib, pkgs, ... }:
+{
+  imports = [
+    ../default.nix
+    ../../../../common/gpu/nvidia.nix
+  ];
+
+  hardware.nvidia.prime = {
+    # 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/modules/nixos-hardware/dell/xps/15-9560/README.wiki b/modules/nixos-hardware/dell/xps/15-9560/README.wiki
new file mode 100644
index 000000000000..faf4ced8bec2
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9560/README.wiki
@@ -0,0 +1,54 @@
+= Dell XPS 15 9560 =
+
+== Tested Hardware ==
+
+* CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
+* RAM: 16 GB
+* HDD: 512 GiB SSD
+* Screen: 15.6" FHD(1920x1080) InfinityEdge
+* Graphics: NVIDIA Corporation GTX1050 4GB GDDR5, with Intel Graphics too.
+* Input: trackpad
+
+
+== Firmware Configuration ==
+
+Not much tweaking of NixOS itself was needed. But we currently cannot automate the firmware setup, so this must be done by hand.
+
+=== Before installation ===
+
+These settings are needed both for booting the final install, and installer itself. Therefore, they must be done first.
+
+* ''Disable Secure Boot (but keep UEFI Boot).'' Thakfully doing so is as easy as changing any other simple setting.
+
+* ''Disable Intel hardware RAID and use AHCI instead.'' Intel doesn't seem to provide a working linux driver for this.  (If you just have SSD it's pointless and just slows things down needlessly anyways.)
+
+
+=== After installation ===
+
+* ''Add systemd-boot to UEFI boot list.'' The (uneditable anyways) settings mapping drive UUIDs to HD* work fine.
+
+=== Optional ===
+
+* ''Disable C-States.'' This is a processor idling thing. It seems to cause random crashes (Blank screen, no normal panic debug dump). Unfortunately, without it, the computer cannot be suspended. On the other hand, it doesn't seem to affect acpi's estimation of battery life when the computer is running with minimal load, but I haven't tested battery life in practice. I list it as optional as there's a tradeoff, and the crashes are rare enough one can probably get through installation just fine.
+
+* ''Update BIOS.'' According to Reddit, this helps with battery life.
+
+* ''Update Intel's Thunderbolt firmware.'' Without this, the Thunderbolt port will only work as power source, and not transfer data.
+
+=== Troubleshooting ===
+
+==== rcu_sched freezing problems ====
+
+After a recent update my machine became unstable. X couldn't start and even running `lspci` would lock the machine. I'm not sure what the root cause was, but I found the fix here: https://wiki.archlinux.org/index.php/Dell_XPS_15_9560#Troubleshooting
+
+TL;DR I added this line:
+  I am leaving these params here, I haven't test these so use on your own risk.
+  I am using different method to disable nvidia.
+  ("acpi_rev_override=1" param is save and I have been using it for a while now,
+  no crashes.)
+
+```
+boot.kernelParams = [ "acpi_rev_override=1" "pcie_aspm=off" "nouveau.modeset=0" ];
+```
+
+Some more detail about the problem can be found here: https://bbs.archlinux.org/viewtopic.php?id=223056
diff --git a/modules/nixos-hardware/dell/xps/15-9560/default.nix b/modules/nixos-hardware/dell/xps/15-9560/default.nix
new file mode 100644
index 000000000000..e7ec6c29d53e
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9560/default.nix
@@ -0,0 +1,24 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop
+    ./xps-common.nix
+  ];
+
+  # This configuration makes intel default and optionaly applications could run nvidia with optirun.
+  # To Optimize for your use case import intel or nvidia only configuration instead
+  # xps-9560/intel
+  # or
+  # xps-9560/nvidia
+
+
+ ##### bumblebee working, needs reboot to take affect and to use it run: optirun "<application>"
+ services.xserver.videoDrivers = lib.mkDefault [ "intel" "nvidia" ];
+ boot.blacklistedKernelModules = lib.mkDefault [ "nouveau" "bbswitch" ];
+ boot.extraModulePackages = lib.mkDefault [ pkgs.linuxPackages.nvidia_x11 ];
+ hardware.bumblebee.enable = lib.mkDefault true;
+ hardware.bumblebee.pmMethod = lib.mkDefault "none";
+
+}
diff --git a/modules/nixos-hardware/dell/xps/15-9560/intel/default.nix b/modules/nixos-hardware/dell/xps/15-9560/intel/default.nix
new file mode 100644
index 000000000000..f20379786ddb
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9560/intel/default.nix
@@ -0,0 +1,18 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../../../common/cpu/intel
+    ../../../../common/pc/laptop
+    ../xps-common.nix
+  ];
+
+
+  # This runs only Intel and nvidia does not drain power.
+
+  ##### disable nvidia, very nice battery life.
+  hardware.nvidiaOptimus.disable = lib.mkDefault true;
+  boot.blacklistedKernelModules = lib.mkDefault [ "nouveau" "nvidia" ];
+  services.xserver.videoDrivers = lib.mkDefault [ "intel" ];
+
+}
diff --git a/modules/nixos-hardware/dell/xps/15-9560/nvidia/default.nix b/modules/nixos-hardware/dell/xps/15-9560/nvidia/default.nix
new file mode 100644
index 000000000000..2cd5d1b158dc
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9560/nvidia/default.nix
@@ -0,0 +1,20 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../../../common/cpu/intel
+    ../../../../common/pc/laptop
+    ../xps-common.nix
+  ];
+
+
+  # This runs only nvidia, great for games or heavy use of render applications
+
+  ##### disable intel, run nvidia only and as default
+  services.xserver.videoDrivers = lib.mkDefault ["nvidia"];
+  hardware.nvidia.modesetting.enable = lib.mkDefault true;
+  hardware.nvidia.optimus_prime.enable = lib.mkDefault true;
+  hardware.nvidia.optimus_prime.nvidiaBusId = lib.mkDefault "PCI:1:0:0";
+  hardware.nvidia.optimus_prime.intelBusId = lib.mkDefault "PCI:0:2:0";
+
+}
diff --git a/modules/nixos-hardware/dell/xps/15-9560/xps-common.nix b/modules/nixos-hardware/dell/xps/15-9560/xps-common.nix
new file mode 100644
index 000000000000..62aae078545d
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/15-9560/xps-common.nix
@@ -0,0 +1,12 @@
+{ lib, ... }:
+
+{
+
+  # Boot loader
+  boot.loader.systemd-boot.enable = lib.mkDefault true;
+  boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
+  boot.kernelParams = lib.mkDefault [ "acpi_rev_override" ];
+
+  # This will save you money and possibly your life!
+  services.thermald.enable = lib.mkDefault true;
+}