about summary refs log tree commit diff
path: root/modules/nixos-hardware
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-05-07 13:45:16 +0000
committerAlyssa Ross <hi@alyssa.is>2020-05-07 13:45:16 +0000
commitae3b78289010b14f2151434bed6282b3689e7444 (patch)
treecd9965d93eaf6b4fd497dc5c500fc9dc880382c5 /modules/nixos-hardware
parent199fc8816a6660627fd4b684ba078e9969ce33c7 (diff)
parent565f837027469fc6c8f9256dea1cfad0dab4f2dc (diff)
downloadnixlib-ae3b78289010b14f2151434bed6282b3689e7444.tar
nixlib-ae3b78289010b14f2151434bed6282b3689e7444.tar.gz
nixlib-ae3b78289010b14f2151434bed6282b3689e7444.tar.bz2
nixlib-ae3b78289010b14f2151434bed6282b3689e7444.tar.lz
nixlib-ae3b78289010b14f2151434bed6282b3689e7444.tar.xz
nixlib-ae3b78289010b14f2151434bed6282b3689e7444.tar.zst
nixlib-ae3b78289010b14f2151434bed6282b3689e7444.zip
Merge commit '565f837027469fc6c8f9256dea1cfad0dab4f2dc'
Diffstat (limited to 'modules/nixos-hardware')
-rw-r--r--modules/nixos-hardware/.travis.yml3
-rw-r--r--modules/nixos-hardware/CODEOWNERS1
-rw-r--r--modules/nixos-hardware/README.md110
-rw-r--r--modules/nixos-hardware/apple/macbook-air/3/default.nix15
-rw-r--r--modules/nixos-hardware/common/cpu/intel/default.nix1
-rw-r--r--modules/nixos-hardware/common/pc/laptop/cpu-throttling-bug.nix38
-rw-r--r--modules/nixos-hardware/common/pc/ssd/default.nix2
-rw-r--r--modules/nixos-hardware/default.nix55
-rw-r--r--modules/nixos-hardware/dell/e7240/README.md8
-rw-r--r--modules/nixos-hardware/dell/e7240/default.nix8
-rw-r--r--modules/nixos-hardware/dell/latitude/3480/default.nix14
-rw-r--r--modules/nixos-hardware/dell/xps/13-7390/README.wiki16
-rw-r--r--modules/nixos-hardware/dell/xps/13-7390/default.nix13
-rw-r--r--modules/nixos-hardware/dell/xps/13-9360/default.nix5
-rw-r--r--modules/nixos-hardware/dell/xps/13-9370/default.nix6
-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-9550/default.nix3
-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
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/default.nix3
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/e495/default.nix11
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/l13/default.nix10
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/p53/default.nix10
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/t420/default.nix9
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/t430/default.nix1
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/t440s/default.nix14
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/t460s/default.nix5
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/t470s/default.nix9
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/t480s/default.nix3
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/t490/default.nix31
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/t490/t490-profile-set.conf107
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/t495/default.nix16
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/x1-extreme/default.nix8
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/x1-extreme/gen2/default.nix48
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/x1/6th-gen/default.nix28
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/x250/default.nix1
-rw-r--r--modules/nixos-hardware/lenovo/thinkpad/x280/default.nix12
-rw-r--r--modules/nixos-hardware/pcengines/apu/default.nix5
-rw-r--r--modules/nixos-hardware/purism/librem/13v3/README.md75
l---------modules/nixos-hardware/purism/librem/15v31
-rw-r--r--modules/nixos-hardware/raspberry-pi/2/default.nix2
-rw-r--r--modules/nixos-hardware/tests/build-profile.nix19
-rwxr-xr-xmodules/nixos-hardware/tests/run.py102
-rw-r--r--modules/nixos-hardware/toshiba/swanky/default.nix3
-rw-r--r--modules/nixos-hardware/tuxedo/infinitybook/v4/default.nix5
51 files changed, 949 insertions, 158 deletions
diff --git a/modules/nixos-hardware/.travis.yml b/modules/nixos-hardware/.travis.yml
index 689c9b6547cb..91cf21da023e 100644
--- a/modules/nixos-hardware/.travis.yml
+++ b/modules/nixos-hardware/.travis.yml
@@ -1,2 +1,3 @@
 language: nix
-script: nix-build --dry-run --show-trace
+script:
+  ./tests/run.py
diff --git a/modules/nixos-hardware/CODEOWNERS b/modules/nixos-hardware/CODEOWNERS
index 563d5163ce17..4f2bb2cc6463 100644
--- a/modules/nixos-hardware/CODEOWNERS
+++ b/modules/nixos-hardware/CODEOWNERS
@@ -1,5 +1,6 @@
 beagleboard/pocketbeagle @yegortimoshenko
 dell/xps/13-9370 @moredread
+dell/xps/13-9380 @kalbasit
 lenovo/thinkpad/x230 @makefu @yegortimoshenko
 lenovo/thinkpad/x250 @Mic92
 pcengines/apu @yegortimoshenko
diff --git a/modules/nixos-hardware/README.md b/modules/nixos-hardware/README.md
index f20bc64487e2..e62a19dcaa12 100644
--- a/modules/nixos-hardware/README.md
+++ b/modules/nixos-hardware/README.md
@@ -6,7 +6,7 @@ Add and update `nixos-hardware` channel:
 
 ```
 $ sudo nix-channel --add https://github.com/NixOS/nixos-hardware/archive/master.tar.gz nixos-hardware
-$ sudo nix-channel --update nixos-hardware
+$ sudo nix-channel --update
 ```
 
 Then import an appropriate profile path from the table below. For example, to
@@ -20,46 +20,79 @@ imports = [
 ];
 ```
 
-## Profiles
+## Incomplete list of Profiles
 
-| Model                             | Path                                         |
-| --------------------------------- | -------------------------------------------- |
-| [Acer Aspire 4810T][]             | `<nixos-hardware/acer/aspire/4810t>`         |
-| Airis N990                        | `<nixos-hardware/airis/n990>`                |
-| Apple MacBook Air 4,X             | `<nixos-hardware/apple/macbook-air/4>`       |
-| Apple MacBook Air 6,X             | `<nixos-hardware/apple/macbook-air/6>`       |
-| [Apple MacBook Pro 10,1][]        | `<nixos-hardware/apple/macbook-pro/10-1>`    |
-| Apple MacBook Pro 12,1            | `<nixos-hardware/apple/macbook-pro/12-1>`    |
-| BeagleBoard PocketBeagle          | `<nixos-hardware/beagleboard/pocketbeagle>`  |
-| [Dell XPS 13 9370][]              | `<nixos-hardware/dell/xps/13-9370>`          |
-| [Dell XPS 15 9550][]              | `<nixos-hardware/dell/xps/15-9550>`          |
-| [Inverse Path USB armory][]       | `<nixos-hardware/inversepath/usbarmory>`     |
-| Lenovo IdeaPad Z510               | `<nixos-hardware/lenovo/ideapad/z510>`       |
-| Lenovo ThinkPad T410              | `<nixos-hardware/lenovo/thinkpad/t410>`      |
-| Lenovo ThinkPad T430              | `<nixos-hardware/lenovo/thinkpad/t430>`      |
-| Lenovo ThinkPad T440p             | `<nixos-hardware/lenovo/thinkpad/t440p>`     |
-| Lenovo ThinkPad T450s             | `<nixos-hardware/lenovo/thinkpad/t450s>`     |
-| Lenovo ThinkPad T460s             | `<nixos-hardware/lenovo/thinkpad/t460s>`     |
-| Lenovo ThinkPad X140e             | `<nixos-hardware/lenovo/thinkpad/x140e>`     |
-| Lenovo ThinkPad X220              | `<nixos-hardware/lenovo/thinkpad/x220>`      |
-| Lenovo ThinkPad X230              | `<nixos-hardware/lenovo/thinkpad/x230>`      |
-| Lenovo ThinkPad X250              | `<nixos-hardware/lenovo/thinkpad/x250>`      |
-| [Lenovo ThinkPad X260][]          | `<nixos-hardware/lenovo/thinkpad/x260>`      |
-| Lenovo ThinkPad X270              | `<nixos-hardware/lenovo/thinkpad/x270>`      |
-| [Lenovo ThinkPad X1 (6th Gen)][]  | `<nixos-hardware/lenovo/thinkpad/x1/6th-gen>`|
-| [Microsoft Surface Pro 3][]       | `<nixos-hardware/microsoft/surface-pro/3>`   |
-| PC Engines APU                    | `<nixos-hardware/pcengines/apu>`             |
-| [Raspberry Pi 2][]                | `<nixos-hardware/raspberry-pi/2>`            |
-| [Samsung Series 9 NP900X3C][]     | `<nixos-hardware/samsung/np900x3c>`          |
-| [Purism Librem 13v3][]            | `<nixos-hardware/purism/librem/13v3>`        |
-| Supermicro A1SRi-2758F            | `<nixos-hardware/supermicro/a1sri-2758f>`    |
-| Supermicro X10SLL-F               | `<nixos-hardware/supermicro/x10sll-f>`       |
-| [Toshiba Chromebook 2 `swanky`][] | `<nixos-hardware/toshiba/swanky>`            |
+See code for all available configurations.
+
+| Model                             | Path                                               |
+| --------------------------------- | -------------------------------------------------- |
+| [Acer Aspire 4810T][]             | `<nixos-hardware/acer/aspire/4810t>`               |
+| Airis N990                        | `<nixos-hardware/airis/n990>`                      |
+| Apple MacBook Air 3,X             | `<nixos-hardware/apple/macbook-air/3>`             |
+| Apple MacBook Air 4,X             | `<nixos-hardware/apple/macbook-air/4>`             |
+| Apple MacBook Air 6,X             | `<nixos-hardware/apple/macbook-air/6>`             |
+| [Apple MacBook Pro 10,1][]        | `<nixos-hardware/apple/macbook-pro/10-1>`          |
+| Apple MacBook Pro 12,1            | `<nixos-hardware/apple/macbook-pro/12-1>`          |
+| BeagleBoard PocketBeagle          | `<nixos-hardware/beagleboard/pocketbeagle>`        |
+| Dell Latitude 3480                | `<nixos-hardware/dell/latitude/3480>`              |
+| [Dell XPS E7240][]                | `<nixos-hardware/dell/e7240>`                      |
+| [Dell XPS 13 7390][]              | `<nixos-hardware/dell/xps/13-7390>`                |
+| [Dell XPS 13 9360][]              | `<nixos-hardware/dell/xps/13-9360>`                |
+| [Dell XPS 13 9370][]              | `<nixos-hardware/dell/xps/13-9370>`                |
+| [Dell XPS 13 9380][]              | `<nixos-hardware/dell/xps/13-9380>`                |
+| [Dell XPS 15 7590][]              | `<nixos-hardware/dell/xps/15-7590>`                |
+| [Dell XPS 15 9550][]              | `<nixos-hardware/dell/xps/15-9550>`                |
+| [Dell XPS 15 9560][]              | `<nixos-hardware/dell/xps/15-9560>`                |
+| [Dell XPS 15 9560, intel only][]  | `<nixos-hardware/dell/xps/15-9560/intel>`          |
+| [Dell XPS 15 9560, nvidia only][] | `<nixos-hardware/dell/xps/15-9560/nvidia>`         |
+| [Inverse Path USB armory][]       | `<nixos-hardware/inversepath/usbarmory>`           |
+| Lenovo IdeaPad Z510               | `<nixos-hardware/lenovo/ideapad/z510>`             |
+| Lenovo ThinkPad E495              | `<nixos-hardware/lenovo/thinkpad/e495>`            |
+| Lenovo ThinkPad L13               | `<nixos-hardware/lenovo/thinkpad/l13>`             |
+| Lenovo ThinkPad P53               | `<nixos-hardware/lenovo/thinkpad/p53>`             |
+| Lenovo ThinkPad T410              | `<nixos-hardware/lenovo/thinkpad/t410>`            |
+| Lenovo ThinkPad T420              | `<nixos-hardware/lenovo/thinkpad/t420>`            |
+| Lenovo ThinkPad T430              | `<nixos-hardware/lenovo/thinkpad/t430>`            |
+| Lenovo ThinkPad T440s             | `<nixos-hardware/lenovo/thinkpad/t440s>`           |
+| Lenovo ThinkPad T440p             | `<nixos-hardware/lenovo/thinkpad/t440p>`           |
+| Lenovo ThinkPad T450s             | `<nixos-hardware/lenovo/thinkpad/t450s>`           |
+| Lenovo ThinkPad T460s             | `<nixos-hardware/lenovo/thinkpad/t460s>`           |
+| Lenovo ThinkPad T470s             | `<nixos-hardware/lenovo/thinkpad/t470s>`           |
+| Lenovo ThinkPad T480s             | `<nixos-hardware/lenovo/thinkpad/t480s>`           |
+| Lenovo ThinkPad T490              | `<nixos-hardware/lenovo/thinkpad/t490>`            |
+| Lenovo ThinkPad T495              | `<nixos-hardware/lenovo/thinkpad/t495>`            |
+| Lenovo ThinkPad X140e             | `<nixos-hardware/lenovo/thinkpad/x140e>`           |
+| Lenovo ThinkPad X220              | `<nixos-hardware/lenovo/thinkpad/x220>`            |
+| Lenovo ThinkPad X230              | `<nixos-hardware/lenovo/thinkpad/x230>`            |
+| Lenovo ThinkPad X250              | `<nixos-hardware/lenovo/thinkpad/x250>`            |
+| [Lenovo ThinkPad X260][]          | `<nixos-hardware/lenovo/thinkpad/x260>`            |
+| Lenovo ThinkPad X270              | `<nixos-hardware/lenovo/thinkpad/x270>`            |
+| Lenovo ThinkPad X280              | `<nixos-hardware/lenovo/thinkpad/x280>`            |
+| [Lenovo ThinkPad X1 (6th Gen)][]  | `<nixos-hardware/lenovo/thinkpad/x1/6th-gen>`      |
+| Lenovo ThinkPad X1 Extreme Gen 2  | `<nixos-hardware/lenovo/thinkpad/x1-extreme/gen2>` |
+| [Microsoft Surface Pro 3][]       | `<nixos-hardware/microsoft/surface-pro/3>`         |
+| PC Engines APU                    | `<nixos-hardware/pcengines/apu>`                   |
+| [Raspberry Pi 2][]                | `<nixos-hardware/raspberry-pi/2>`                  |
+| [Samsung Series 9 NP900X3C][]     | `<nixos-hardware/samsung/np900x3c>`                |
+| [Purism Librem 13v3][]            | `<nixos-hardware/purism/librem/13v3>`              |
+| [Purism Librem 15v3][]            | `<nixos-hardware/purism/librem/15v3>`              |
+| Supermicro A1SRi-2758F            | `<nixos-hardware/supermicro/a1sri-2758f>`          |
+| Supermicro X10SLL-F               | `<nixos-hardware/supermicro/x10sll-f>`             |
+| [Toshiba Chromebook 2 `swanky`][] | `<nixos-hardware/toshiba/swanky>`                  |
+| [Tuxedo InfinityBook v4][]        | `<nixos-hardware/tuxedo/infinitybook/v4>`          |
 
 [Acer Aspire 4810T]: acer/aspire/4810t
 [Apple MacBook Pro 10,1]: apple/macbook-pro/10-1
+[Dell XPS E7240]: dell/e7240
+[Dell XPS 13 7390]: dell/xps/13-7390
+[Dell XPS 13 9360]: dell/xps/13-9360
 [Dell XPS 13 9370]: dell/xps/13-9370
+[Dell XPS 13 9380]: dell/xps/13-9380
+[Dell XPS 15 7590]: dell/xps/15-7590
 [Dell XPS 15 9550]: dell/xps/15-9550
+[Dell XPS 15 9560]: dell/xps/15-9560
+[Dell XPS 15 9560, intel only]: dell/xps/15-9560/intel
+[Dell XPS 15 9560, nvidia only]: dell/xps/15-9560/nvidia
 [Inverse Path USB armory]: inversepath/usbarmory
 [Lenovo ThinkPad X1 (6th Gen)]: lenovo/thinkpad/x1/6th-gen
 [Lenovo ThinkPad X260]: lenovo/thinkpad/x260
@@ -67,4 +100,11 @@ imports = [
 [Raspberry Pi 2]: raspberry-pi/2
 [Samsung Series 9 NP900X3C]: samsung/np900x3c
 [Purism Librem 13v3]: purism/librem/13v3
+[Purism Librem 13v5]: purism/librem/13v5
 [Toshiba Chromebook 2 `swanky`]: toshiba/swanky
+
+## How to contribute a new device profile
+
+1. Add your device profile expression in the appropriate directory
+2. Link it in the table in README.md
+3. Run ./tests/run.py to test it. The test script script will parse all the profiles from the README.md
diff --git a/modules/nixos-hardware/apple/macbook-air/3/default.nix b/modules/nixos-hardware/apple/macbook-air/3/default.nix
new file mode 100644
index 000000000000..03221edcd0b0
--- /dev/null
+++ b/modules/nixos-hardware/apple/macbook-air/3/default.nix
@@ -0,0 +1,15 @@
+{ config, lib, ... }:
+
+{
+  imports = [ 
+    ../../.
+    ../../../common/pc/laptop
+    ../../../common/pc/ssd
+  ];
+
+  # Built-in iSight is recognized by the generic uvcvideo kernel module
+  hardware.facetimehd.enable = false;
+
+  hardware.cpu.intel.updateMicrocode =
+    lib.mkDefault config.hardware.enableRedistributableFirmware;
+}
diff --git a/modules/nixos-hardware/common/cpu/intel/default.nix b/modules/nixos-hardware/common/cpu/intel/default.nix
index 7f2223c72e40..ad945f394a6c 100644
--- a/modules/nixos-hardware/common/cpu/intel/default.nix
+++ b/modules/nixos-hardware/common/cpu/intel/default.nix
@@ -10,5 +10,6 @@
     vaapiIntel
     vaapiVdpau
     libvdpau-va-gl
+    intel-media-driver
   ];
 }
diff --git a/modules/nixos-hardware/common/pc/laptop/cpu-throttling-bug.nix b/modules/nixos-hardware/common/pc/laptop/cpu-throttling-bug.nix
deleted file mode 100644
index a44bb7225d0f..000000000000
--- a/modules/nixos-hardware/common/pc/laptop/cpu-throttling-bug.nix
+++ /dev/null
@@ -1,38 +0,0 @@
-{ config, pkgs, ... }:
-{
-  # Temporary fix for cpu throttling issues visible in the kernel log
-  # (journalctl -k) by setting the same temperature limits used by
-  # Window$
-  # See https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues
-  systemd.services.cpu-throttling = {
-    enable = true;
-    description = "Sets the offset to 3 °C, so the new trip point is 97 °C";
-    documentation = [
-      "https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues"
-    ];
-    path = [ pkgs.msr-tools ];
-    script = "wrmsr -a 0x1a2 0x3000000";
-    serviceConfig = {
-      Type = "oneshot";
-    };
-    wantedBy = [
-      "timers.target"
-    ];
-  };
-
-  systemd.timers.cpu-throttling = {
-    enable = true;
-    description = "Set cpu heating limit to 97 °C";
-    documentation = [
-      "https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues"
-    ];
-    timerConfig = {
-      OnActiveSec = 60;
-      OnUnitActiveSec = 60;
-      Unit = "cpu-throttling.service";
-    };
-    wantedBy = [
-      "timers.target"
-    ];
-  };
-}
diff --git a/modules/nixos-hardware/common/pc/ssd/default.nix b/modules/nixos-hardware/common/pc/ssd/default.nix
index af0b49568cd1..00922e649938 100644
--- a/modules/nixos-hardware/common/pc/ssd/default.nix
+++ b/modules/nixos-hardware/common/pc/ssd/default.nix
@@ -4,4 +4,6 @@
   boot.kernel.sysctl = {
     "vm.swappiness" = lib.mkDefault 1;
   };
+
+  services.fstrim.enable = lib.mkDefault true;
 }
diff --git a/modules/nixos-hardware/default.nix b/modules/nixos-hardware/default.nix
index 097b8bc5f90a..fbb5b77061ff 100644
--- a/modules/nixos-hardware/default.nix
+++ b/modules/nixos-hardware/default.nix
@@ -1,52 +1,3 @@
-{ ... }:
-
-let
-  shim = {
-    boot.loader.systemd-boot.enable = true;
-
-    fileSystems."/" = {
-      device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000";
-      fsType = "btrfs";
-    };
-
-    nixpkgs.config = {
-      allowBroken = true;
-      allowUnfree = true;
-    };
-  };
-
-  buildProfile = profile: (import <nixpkgs/nixos> {
-    configuration.imports = [ profile shim ];
-  }).system;
-in
-
-{
-  acer-aspire-4810t = buildProfile ./acer/aspire/4810t;
-
-  airis-n990 = buildProfile ./airis/n990;
-
-  apple-macbook-air-4 = buildProfile ./apple/macbook-air/4;
-  apple-macbook-air-6 = buildProfile ./apple/macbook-air/6;
-  apple-macbook-pro-10-1 = buildProfile ./apple/macbook-pro/10-1;
-  apple-macbook-pro-11-5 = buildProfile ./apple/macbook-pro/11-5;
-  apple-macbook-pro-12-1 = buildProfile ./apple/macbook-pro/12-1;
-
-  dell-xps-13-9370 = buildProfile ./dell/xps/13-9370;
-  dell-xps-15-9550 = buildProfile ./dell/xps/15-9550;
-
-  lenovo-thinkpad-t410 = buildProfile ./lenovo/thinkpad/t410;
-  lenovo-thinkpad-t440p = buildProfile ./lenovo/thinkpad/t440p;
-  lenovo-thinkpad-t450s = buildProfile ./lenovo/thinkpad/t450s;
-  lenovo-thinkpad-t460s = buildProfile ./lenovo/thinkpad/t460s;
-  lenovo-thinkpad-x140e = buildProfile ./lenovo/thinkpad/x140e;
-  lenovo-thinkpad-x220 = buildProfile ./lenovo/thinkpad/x220;
-  lenovo-thinkpad-x230 = buildProfile ./lenovo/thinkpad/x230;
-  lenovo-thinkpad-x250 = buildProfile ./lenovo/thinkpad/x250;
-  lenovo-thinkpad-x260 = buildProfile ./lenovo/thinkpad/x260;
-
-  microsoft-surface-pro-3 = buildProfile ./microsoft/surface-pro/3;
-
-  pcengines-apu = buildProfile ./pcengines/apu;
-
-  toshiba-swanky = buildProfile ./toshiba/swanky;
-}
+# This file is necessary so nix-env -qa does not break,
+# when nixos-hardware is used as a channel
+{}
diff --git a/modules/nixos-hardware/dell/e7240/README.md b/modules/nixos-hardware/dell/e7240/README.md
new file mode 100644
index 000000000000..b712f4d2bc25
--- /dev/null
+++ b/modules/nixos-hardware/dell/e7240/README.md
@@ -0,0 +1,8 @@
+On some kernel versions user ashgillman has experiences suspend issues
+(see https://bugzilla.redhat.com/show_bug.cgi?id=1597481).
+
+Try:
+
+```nix
+boot.kernelPackages = pkgs.linuxPackages_4_14;
+```
diff --git a/modules/nixos-hardware/dell/e7240/default.nix b/modules/nixos-hardware/dell/e7240/default.nix
new file mode 100644
index 000000000000..3334a745f8c3
--- /dev/null
+++ b/modules/nixos-hardware/dell/e7240/default.nix
@@ -0,0 +1,8 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../common/cpu/intel
+    ../../common/pc/laptop
+  ];
+}
diff --git a/modules/nixos-hardware/dell/latitude/3480/default.nix b/modules/nixos-hardware/dell/latitude/3480/default.nix
new file mode 100644
index 000000000000..86be458a1d96
--- /dev/null
+++ b/modules/nixos-hardware/dell/latitude/3480/default.nix
@@ -0,0 +1,14 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop
+    ../../../common/pc/laptop/ssd
+  ];
+
+  # touchpad goes over i2c
+  boot.blacklistedKernelModules = [ "psmouse" ];
+
+  services.xserver.videoDrivers = lib.mkDefault [ "intel" ];
+}
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..991e4352cb50
--- /dev/null
+++ b/modules/nixos-hardware/dell/xps/13-7390/default.nix
@@ -0,0 +1,13 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop
+    ../../../common/pc/laptop/ssd
+  ];
+
+  boot.kernelParams = [ "mem_sleep_default=deep" ];
+
+  services.thermald.enable = true;
+}
diff --git a/modules/nixos-hardware/dell/xps/13-9360/default.nix b/modules/nixos-hardware/dell/xps/13-9360/default.nix
index e13e758d44c7..5ff1e54a46b6 100644
--- a/modules/nixos-hardware/dell/xps/13-9360/default.nix
+++ b/modules/nixos-hardware/dell/xps/13-9360/default.nix
@@ -13,7 +13,7 @@
     efi.canTouchEfiVariables = lib.mkDefault true;
     systemd-boot.enable = lib.mkDefault true;
   };
-  
+
   hardware.firmware = lib.mkBefore [ pkgs.qca6174-firmware ];
 
   # TODO: move to general HiDPI profile
@@ -23,4 +23,7 @@
   nixpkgs.overlays = [(final: previous: {
     qca6174-firmware = final.callPackage ./qca6174-firmware.nix {};
   })];
+
+  # This will save you money and possibly your life!
+  services.thermald.enable = true;
 }
diff --git a/modules/nixos-hardware/dell/xps/13-9370/default.nix b/modules/nixos-hardware/dell/xps/13-9370/default.nix
index cd53acd02fc0..dbe852f0c27f 100644
--- a/modules/nixos-hardware/dell/xps/13-9370/default.nix
+++ b/modules/nixos-hardware/dell/xps/13-9370/default.nix
@@ -5,7 +5,6 @@
     ../../../common/cpu/intel/kaby-lake
     ../../../common/pc/laptop
     ../../../common/pc/laptop/acpi_call.nix
-    ../../../common/pc/laptop/cpu-throttling-bug.nix
   ];
 
   # Force S3 sleep mode. See README.wiki for details.
@@ -13,4 +12,9 @@
 
   # 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-9550/default.nix b/modules/nixos-hardware/dell/xps/15-9550/default.nix
index 90cfc6e2936a..9677972a6b70 100644
--- a/modules/nixos-hardware/dell/xps/15-9550/default.nix
+++ b/modules/nixos-hardware/dell/xps/15-9550/default.nix
@@ -10,6 +10,9 @@
   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-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;
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/default.nix b/modules/nixos-hardware/lenovo/thinkpad/default.nix
index ff22639b4fdc..99d4937e49c7 100644
--- a/modules/nixos-hardware/lenovo/thinkpad/default.nix
+++ b/modules/nixos-hardware/lenovo/thinkpad/default.nix
@@ -1,9 +1,10 @@
-{ lib, pkgs, ... }:
+{ config, lib, pkgs, ... }:
 
 {
   imports = [ ../../common/pc/laptop ];
 
   hardware.trackpoint.enable = lib.mkDefault true;
+  hardware.trackpoint.emulateWheel = lib.mkDefault config.hardware.trackpoint.enable;
 
   # Fingerprint reader: login and unlock with fingerprint (if you add one with `fprintd-enroll`)
   # services.fprintd.enable = true;
diff --git a/modules/nixos-hardware/lenovo/thinkpad/e495/default.nix b/modules/nixos-hardware/lenovo/thinkpad/e495/default.nix
new file mode 100644
index 000000000000..51ddb5cfd010
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/e495/default.nix
@@ -0,0 +1,11 @@
+{ config, lib, pkgs, ... }:
+
+{
+  imports = [
+    ../.
+    ../../../common/cpu/amd
+  ];
+
+  # see https://github.com/NixOS/nixpkgs/issues/69289
+  boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.2") pkgs.linuxPackages_latest;
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/l13/default.nix b/modules/nixos-hardware/lenovo/thinkpad/l13/default.nix
new file mode 100644
index 000000000000..3c09f5091ed8
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/l13/default.nix
@@ -0,0 +1,10 @@
+{ nixos, lib, pkgs, config, stdenv, ... }:
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
+    ../.
+  ];
+
+  services.throttled.enable = lib.mkDefault true;
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/p53/default.nix b/modules/nixos-hardware/lenovo/thinkpad/p53/default.nix
new file mode 100644
index 000000000000..a499d5c2d51e
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/p53/default.nix
@@ -0,0 +1,10 @@
+{ nixos, pkgs, lib, config, stdenv, ... }:
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
+    ../.
+  ];
+
+  services.throttled.enable = lib.mkDefault true;
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/t420/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t420/default.nix
new file mode 100644
index 000000000000..5d3efe831c96
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/t420/default.nix
@@ -0,0 +1,9 @@
+{ config, lib, pkgs, ... }:
+
+{
+  imports = [
+    ../.
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
+  ];
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/t430/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t430/default.nix
index 09cee74942e9..bdad1be9878a 100644
--- a/modules/nixos-hardware/lenovo/thinkpad/t430/default.nix
+++ b/modules/nixos-hardware/lenovo/thinkpad/t430/default.nix
@@ -4,6 +4,7 @@
   imports = [
     ../.
     ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
   ];
 
   boot = {
diff --git a/modules/nixos-hardware/lenovo/thinkpad/t440s/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t440s/default.nix
new file mode 100644
index 000000000000..c40ad90f9b3d
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/t440s/default.nix
@@ -0,0 +1,14 @@
+{ config, lib, pkgs, ... }:
+
+{
+  imports = [
+    ../.
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
+  ];
+
+  boot = {
+    # TODO: probably enable tcsd? Is this line necessary?
+    kernelModules = [ "tpm-rng" ];
+  };
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/t460s/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t460s/default.nix
index 41558a35b7f6..e62337171b9a 100644
--- a/modules/nixos-hardware/lenovo/thinkpad/t460s/default.nix
+++ b/modules/nixos-hardware/lenovo/thinkpad/t460s/default.nix
@@ -3,10 +3,7 @@
 {
   imports = [
     ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
     ../.
   ];
-
-  # TODO: boot loader
-  boot.loader.systemd-boot.enable = lib.mkDefault true;
-  boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
 }
diff --git a/modules/nixos-hardware/lenovo/thinkpad/t470s/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t470s/default.nix
new file mode 100644
index 000000000000..e62337171b9a
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/t470s/default.nix
@@ -0,0 +1,9 @@
+{ config, lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
+    ../.
+  ];
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/t480s/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t480s/default.nix
index 3e079d5fb060..1a14afa6b5e4 100644
--- a/modules/nixos-hardware/lenovo/thinkpad/t480s/default.nix
+++ b/modules/nixos-hardware/lenovo/thinkpad/t480s/default.nix
@@ -4,7 +4,8 @@
   imports = [
     ../../../common/cpu/intel
     ../../../common/pc/laptop/acpi_call.nix
-    ../../../common/pc/laptop/cpu-throttling-bug.nix
     ../.
   ];
+
+  services.throttled.enable = lib.mkDefault true;
 }
diff --git a/modules/nixos-hardware/lenovo/thinkpad/t490/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t490/default.nix
new file mode 100644
index 000000000000..3578da66c73d
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/t490/default.nix
@@ -0,0 +1,31 @@
+{ nixos, lib, pkgs, config, stdenv, ... }:
+{
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
+    ../.
+  ];
+
+  services = {
+    # This fixes the pulseaudio profiles of the Thinkpad T490.
+    # The laptop contains a single audio card with 5 sub-devices. Default pulseaudio only offers a single sink
+    # which can only be switched between speaker/HDMI via a manual profile change.
+    # This configures a profile set for pulseaudio which offers multiple sinks corresponding to the
+    # speaker + 4 HDMI ports. This allows the user to play audio streams on the speaker and any of the 4 HDMI/USB-C
+    # ports at the same time.
+    udev.extraRules = let
+      t490ProfileSet = ./t490-profile-set.conf;
+    in ''
+    SUBSYSTEM!="sound", GOTO="pulseaudio_end"
+    ACTION!="change", GOTO="pulseaudio_end"
+    KERNEL!="card*", GOTO="pulseaudio_end"
+
+    # Lenovo T490
+    ATTRS{vendor}=="0x8086" ATTRS{device}=="0x9dc8" ATTRS{subsystem_vendor}=="0x17aa", ATTRS{subsystem_device}=="0x2279", ENV{PULSE_PROFILE_SET}="${t490ProfileSet}"
+
+    LABEL="pulseaudio_end"
+    '';
+    
+    throttled.enable = lib.mkDefault true;
+  };
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/t490/t490-profile-set.conf b/modules/nixos-hardware/lenovo/thinkpad/t490/t490-profile-set.conf
new file mode 100644
index 000000000000..98f8f0318de1
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/t490/t490-profile-set.conf
@@ -0,0 +1,107 @@
+[Profile speaker+hdmi-stereo]
+description = Speaker + HDMI Stereo
+output-mappings = analog-stereo hdmi-stereo hdmi-stereo-extra1 hdmi-stereo-extra2
+input-mappings = analog-stereo
+
+[Mapping analog-stereo]
+device-strings = front:%f
+channel-map = left,right
+paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2
+paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
+priority = 15
+
+[Mapping hdmi-stereo]
+description = Stereo (HDMI)
+device-strings = hdmi:%f
+paths-output = hdmi-output-0
+channel-map = left,right
+priority = 6
+direction = output
+
+[Mapping hdmi-stereo-extra1]
+description = Stereo (HDMI 2)
+device-strings = hdmi:%f,1
+paths-output = hdmi-output-1
+channel-map = left,right
+priority = 8
+direction = output
+
+[Mapping hdmi-stereo-extra2]
+description = Stereo (HDMI 3)
+device-strings = hdmi:%f,2
+paths-output = hdmi-output-2
+channel-map = left,right
+priority = 6
+direction = output
+
+[Profile speaker+hdmi-surround]
+description = Speaker + HDMI 5.1
+output-mappings = analog-stereo hdmi-surround hdmi-surround-extra1 hdmi-surround-extra2
+input-mappings = analog-stereo
+
+[Mapping analog-stereo]
+device-strings = front:%f
+channel-map = left,right
+paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2
+paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
+priority = 15
+
+[Mapping hdmi-surround]
+description = Digital Surround 5.1 (HDMI)
+device-strings = hdmi:%f
+paths-output = hdmi-output-0
+channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
+priority = 6
+direction = output
+
+[Mapping hdmi-surround-extra1]
+description = Digital Surround 5.1 (HDMI 2)
+device-strings = hdmi:%f,1
+paths-output = hdmi-output-1
+channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
+priority = 8
+direction = output
+
+[Mapping hdmi-surround-extra2]
+description = Digital Surround 5.1 (HDMI 3)
+device-strings = hdmi:%f,2
+paths-output = hdmi-output-2
+channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
+priority = 6
+direction = output
+
+[Profile speaker+hdmi-surround71]
+description = Speaker + HDMI 7.1
+output-mappings = analog-stereo hdmi-surround71 hdmi-surround71-extra1 hdmi-surround71-extra2
+input-mappings = analog-stereo
+
+[Mapping analog-stereo]
+device-strings = front:%f
+channel-map = left,right
+paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2
+paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
+priority = 15
+
+[Mapping hdmi-surround71]
+description = Digital Surround 7.1 (HDMI)
+device-strings = hdmi:%f
+paths-output = hdmi-output-0
+channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
+priority = 6
+direction = output
+
+[Mapping hdmi-surround71-extra1]
+description = Digital Surround 7.1 (HDMI 2)
+device-strings = hdmi:%f,1
+paths-output = hdmi-output-1
+channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
+priority = 8
+direction = output
+
+[Mapping hdmi-surround71-extra2]
+description = Digital Surround 7.1 (HDMI 3)
+device-strings = hdmi:%f,2
+paths-output = hdmi-output-2
+channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
+priority = 6
+direction = output
diff --git a/modules/nixos-hardware/lenovo/thinkpad/t495/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t495/default.nix
new file mode 100644
index 000000000000..64957e6e06c7
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/t495/default.nix
@@ -0,0 +1,16 @@
+{ config, lib, pkgs, ... }:
+
+{
+  imports = [
+    ../.
+    ../../../common/cpu/amd
+    ../../../common/pc/laptop/acpi_call.nix
+  ];
+
+  # Force use of the thinkpad_acpi driver for backlight control.
+  # This allows the backlight save/load systemd service to work.
+  boot.kernelParams = [ "acpi_backlight=native" ];
+
+  # see https://github.com/NixOS/nixpkgs/issues/69289
+  boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.2") pkgs.linuxPackages_latest;
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/x1-extreme/default.nix b/modules/nixos-hardware/lenovo/thinkpad/x1-extreme/default.nix
new file mode 100644
index 000000000000..09a0ec1700a5
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/x1-extreme/default.nix
@@ -0,0 +1,8 @@
+{
+  imports = [
+    ../.
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
+    ../../../common/pc/laptop/ssd
+  ];
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/x1-extreme/gen2/default.nix b/modules/nixos-hardware/lenovo/thinkpad/x1-extreme/gen2/default.nix
new file mode 100644
index 000000000000..6b0ebbd5d1e3
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/x1-extreme/gen2/default.nix
@@ -0,0 +1,48 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+  imports = [
+    ../.
+  ];
+
+  # Fixes an issue with incorrect battery reporting. See
+  # https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Extreme_(Gen_2)#Invalid_Stats_Workaround
+  boot.initrd.availableKernelModules = [ "battery" ];
+
+  # New ThinkPads have a different TrackPoint manufacturer/name.
+  # See also https://certification.ubuntu.com/catalog/component/input/5313/input%3ATPPS/2ElanTrackPoint/
+  hardware.trackpoint.device = "TPPS/2 Elan TrackPoint";
+
+  # Since the HDMI port is connected to the NVIDIA card.
+  hardware.bumblebee.connectDisplay = true;
+
+  nixpkgs.overlays = [
+    (self: super: {
+      bumblebee = super.bumblebee.override {
+        extraNvidiaDeviceOptions = ''
+          Option "AllowEmptyInitialConfiguration"
+        '';
+      };
+    })
+  ];
+
+  services.xserver = mkMerge [
+    {
+      # Set the right DPI. xdpyinfo says the screen is 508×285 mm but
+      # it actually is 344×193 mm.
+      monitorSection = ''
+        DisplaySize 344 193
+      '';
+    }
+
+    # To support intel-virtual-output when using Bumblebee.
+    (mkIf config.hardware.bumblebee.enable {
+      deviceSection = ''Option "VirtualHeads" "1"'';
+      videoDrivers = [ "intel" ];
+    })
+  ];
+
+  services.throttled.enable = lib.mkDefault true;
+}
diff --git a/modules/nixos-hardware/lenovo/thinkpad/x1/6th-gen/default.nix b/modules/nixos-hardware/lenovo/thinkpad/x1/6th-gen/default.nix
index 9584bc744571..00446b8c278b 100644
--- a/modules/nixos-hardware/lenovo/thinkpad/x1/6th-gen/default.nix
+++ b/modules/nixos-hardware/lenovo/thinkpad/x1/6th-gen/default.nix
@@ -2,31 +2,19 @@
 # standing with kernel 4.6.11 is the following wiki page:
 # https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6). The
 # TrackPoint and TouchPad issues there seem to have been fixed already.
-
-{ config, pkgs, ... }:
+#
+# Enable the lower-power S3 suspend state by upgrading the BIOS to version >= 1.30,
+# then manually selecting Linux in the power management section.
+{ config, pkgs, lib, ... }:
 {
   imports = [
     ../.
     ../../../../common/pc/laptop/acpi_call.nix
-    ../../../../common/pc/laptop/cpu-throttling-bug.nix
   ];
 
-  # See https://linrunner.de/en/tlp/docs/tlp-faq.html#battery
-  services.tlp.extraConfig = ''
-    START_CHARGE_THRESH_BAT0=75
-    STOP_CHARGE_THRESH_BAT0=80
-    CPU_SCALING_GOVERNOR_ON_BAT=powersave
-    ENERGY_PERF_POLICY_ON_BAT=powersave
-  '';
+  # New ThinkPads have a different TrackPoint manufacturer/name.
+  # See also https://certification.ubuntu.com/catalog/component/input/5313/input%3ATPPS/2ElanTrackPoint/
+  hardware.trackpoint.device = "TPPS/2 Elan TrackPoint";
 
-  # Enable S3 suspend state: you have to manually follow the
-  # instructions shown here: https://delta-xi.net/#056 in order to
-  # produce the ACPI patched table. Put the CPIO archive in /boot and
-  # then enable the following lines
-  # boot.kernelParams = [
-  #   "mem_sleep_default=deep"
-  # ];
-  # boot.initrd.prepend = [
-  #   "${/boot/acpi_override}"
-  # ];
+  services.throttled.enable = lib.mkDefault true;
 }
diff --git a/modules/nixos-hardware/lenovo/thinkpad/x250/default.nix b/modules/nixos-hardware/lenovo/thinkpad/x250/default.nix
index 870d9a857742..55ae2096342e 100644
--- a/modules/nixos-hardware/lenovo/thinkpad/x250/default.nix
+++ b/modules/nixos-hardware/lenovo/thinkpad/x250/default.nix
@@ -2,5 +2,6 @@
   imports = [
     ../.
     ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
   ];
 }
diff --git a/modules/nixos-hardware/lenovo/thinkpad/x280/default.nix b/modules/nixos-hardware/lenovo/thinkpad/x280/default.nix
new file mode 100644
index 000000000000..a9423e547321
--- /dev/null
+++ b/modules/nixos-hardware/lenovo/thinkpad/x280/default.nix
@@ -0,0 +1,12 @@
+{ config, pkgs, lib, ... }:
+
+{
+  imports = [
+    ../.
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop/acpi_call.nix
+    ../../../common/pc/laptop/ssd/default.nix
+  ];
+
+  services.throttled.enable = lib.mkDefault true;
+}
diff --git a/modules/nixos-hardware/pcengines/apu/default.nix b/modules/nixos-hardware/pcengines/apu/default.nix
index f59f35a25426..521887fe600b 100644
--- a/modules/nixos-hardware/pcengines/apu/default.nix
+++ b/modules/nixos-hardware/pcengines/apu/default.nix
@@ -1,3 +1,8 @@
 {
   boot.kernelParams = [ "console=ttyS0,115200n8" ];
+  boot.loader.grub.extraConfig = "
+    serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
+    terminal_input serial
+    terminal_output serial
+  ";
 }
diff --git a/modules/nixos-hardware/purism/librem/13v3/README.md b/modules/nixos-hardware/purism/librem/13v3/README.md
index 8009eb3279c4..b4bae0b2f886 100644
--- a/modules/nixos-hardware/purism/librem/13v3/README.md
+++ b/modules/nixos-hardware/purism/librem/13v3/README.md
@@ -1,3 +1,6 @@
+This config is for [Librem 13v3](https://puri.sm/products/librem-13/) and [15v3](https://puri.sm/products/librem-15/) Laptops from Purism.
+
+
 Librem comes with Coreboot + SeaBIOS payload. That means EFI boot is not
 possible. Use `fdisk` to partition hard drive, and GRUB as a bootloader:
 
@@ -10,3 +13,75 @@ possible. Use `fdisk` to partition hard drive, and GRUB as a bootloader:
   };
 }
 ```
+
+## Adding a PureOS partition to the GRUB menu
+
+I first assume that `boot.loader.grub.useOSProber = true;` should be sufficient.
+However GRUB was not able to identify the disks correctly and it took me several
+reinstallation till setting `boot.loader.grub.fsIdentifier= "provided";` and using
+boot.loader.grub.extraEntries allowed me to dual boot NixOS and PureOS.
+
+Be aware that each time the PureOS updates the /boot/grub/grub.cfg you will be unable
+to boot into NixOS unless you patch grub.cfg manually again.
+
+Therefore: If you want to be able to boot into your old PureOS distribution
+add the following lines, assuming that you have a separate boot partition
+Adapt linux version and the UUID to your disk!!
+
+
+```nix
+{
+  boot.loader.grub.useOSProber = false;
+  boot.loader.grub.fsIdentifier= "provided";
+  boot.loader.grub.extraEntries = ''
+  menuentry "PureOS with linux 4.19.0-5-amd64 on /dev/sdb2 " {
+      insmod gzio
+      if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
+      insmod part_msdos
+      insmod ext2
+      set root='hd0,msdos1'
+      if [ x$feature_platform_search_hint = xy ]; then
+        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  ef7a4dcf-8cc4-4870-b860-3ed64906f9b9
+      else
+        search --no-floppy --fs-uuid --set=root ef7a4dcf-8cc4-4870-b860-3ed64906f9b9
+      fi
+      linux   /vmlinuz-4.19.0-5-amd64 root=UUID=43899f26-04f2-4ccb-b52a-c9441f1a1a6d ro  quiet splash resume=UUID=923317f8-d8bb-4e1f-bca3-f36a556de609 # $vt_handoff
+      initrd  /initrd.img-4.19.0-5-amd64
+  };
+}
+```
+
+## Automatically lock the desktop when removing the librem key
+
+The [instructions](https://docs.puri.sm/Librem_Key/Getting_Started/User_Manual.html#automatically-lock-the-desktop-when-removing-the-librem-key) to lock the screen after unplugging the [Librem Key](https://puri.sm/products/librem-key/#overview) don't work under NixOS.
+
+This snippet works on my Librem 15v3 laptop running KDE without wayland and is using the xlock from the package xlockmore.
+
+```nix
+{ pkgs, services , systemd, ... }:
+let
+  libremScreenSaver = pkgs.writeScriptBin "libremScreenSaver" ''
+  #!${pkgs.bash}/bin/bash
+  user=`ps aux | egrep "start_kdeinit|gdm-(wayland|x)-session"| head -n 1 | awk '{print $1}'`
+  if [ -n "$user" ]; then
+    sudo -u $user DISPLAY=:0 xlock 2>&1 | logger lockScreen for user $user
+  else
+    logger libremScreenSaver failed to find a user. Not running KDE?
+  fi
+  '';
+
+in {
+  services.udev.path = [ pkgs.procps pkgs.logger pkgs.gawk pkgs.xlockmore ];
+  services.udev.extraRules = ''
+    ACTION=="remove", ENV{PRODUCT}=="316d/4c4b/101" RUN+="${pkgs.systemd}/bin/systemctl --no-block start lockScreen@%k.service"
+  '';
+  systemd.services."lockScreen@" = {
+    bindsTo = [ "dev-%i.device"] ;
+    path = [ pkgs.procps pkgs.logger pkgs.sudo pkgs.xlockmore pkgs.gawk ] ;
+    serviceConfig = {
+        Type = "oneshot"; # was simple
+        ExecStart = "${libremScreenSaver}/bin/libremScreenSaver %I";
+    };
+  };
+}
+```
diff --git a/modules/nixos-hardware/purism/librem/15v3 b/modules/nixos-hardware/purism/librem/15v3
new file mode 120000
index 000000000000..feb0d06fafda
--- /dev/null
+++ b/modules/nixos-hardware/purism/librem/15v3
@@ -0,0 +1 @@
+13v3/
\ No newline at end of file
diff --git a/modules/nixos-hardware/raspberry-pi/2/default.nix b/modules/nixos-hardware/raspberry-pi/2/default.nix
index bc9ca2ab0c23..d10bbd2424d9 100644
--- a/modules/nixos-hardware/raspberry-pi/2/default.nix
+++ b/modules/nixos-hardware/raspberry-pi/2/default.nix
@@ -4,7 +4,7 @@
   boot = {
     consoleLogLevel = lib.mkDefault 7;
     extraTTYs = [ "ttyAMA0" ];
-    kernelPackages = lib.mkDefault pkgs.linuxPackages_rpi;
+    kernelPackages = lib.mkDefault pkgs.linuxPackages_rpi2;
     kernelParams = [
       "dwc_otg.lpm_enable=0"
       "console=ttyAMA0,115200"
diff --git a/modules/nixos-hardware/tests/build-profile.nix b/modules/nixos-hardware/tests/build-profile.nix
new file mode 100644
index 000000000000..c4509d36ad33
--- /dev/null
+++ b/modules/nixos-hardware/tests/build-profile.nix
@@ -0,0 +1,19 @@
+{ profile }:
+
+let
+  shim = {
+    boot.loader.systemd-boot.enable = true;
+
+    fileSystems."/" = {
+      device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000";
+      fsType = "btrfs";
+    };
+
+    nixpkgs.config = {
+      allowBroken = true;
+      allowUnfree = true;
+    };
+  };
+in (import <nixpkgs/nixos> {
+  configuration.imports = [ profile shim ];
+}).system
diff --git a/modules/nixos-hardware/tests/run.py b/modules/nixos-hardware/tests/run.py
new file mode 100755
index 000000000000..653337d19190
--- /dev/null
+++ b/modules/nixos-hardware/tests/run.py
@@ -0,0 +1,102 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -p nix -p python3 -i python
+
+import argparse
+import multiprocessing
+import re
+import subprocess
+import sys
+from pathlib import Path
+from typing import List, Tuple
+
+TEST_ROOT = Path(__file__).resolve().parent
+ROOT = TEST_ROOT.parent
+
+GREEN = "\033[92m"
+RED = "\033[91m"
+RESET = "\033[0m"
+
+
+def parse_readme() -> List[str]:
+    profiles = set()
+    with open(ROOT.joinpath("README.md")) as f:
+        for line in f:
+            results = re.findall(r"<nixos-hardware/[^>]+>", line)
+            profiles.update(results)
+    return list(profiles)
+
+
+def build_profile(profile: str) -> Tuple[str, subprocess.CompletedProcess]:
+    # Hard-code this for now until we have enough other architectures to care about this.
+    system = "x86_64-linux"
+    if "raspberry-pi/2" in profile:
+        system = "armv7l-linux"
+
+    cmd = [
+        "nix-build",
+        "-I",
+        f"nixos-hardware={ROOT}",
+        "--dry-run",
+        "--show-trace",
+        "build-profile.nix",
+        "--system",
+        system,
+        "--arg",
+        "profile",
+        profile,
+    ]
+    res = subprocess.run(
+        cmd, cwd=TEST_ROOT, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True,
+    )
+    return (profile, res)
+
+
+def parse_args() -> argparse.Namespace:
+    parser = argparse.ArgumentParser(description="Run hardware tests")
+    parser.add_argument(
+        "--jobs",
+        type=int,
+        default=multiprocessing.cpu_count(),
+        help="Number of parallel evaluations."
+        "If set to 1 it disable multi processing (suitable for debugging)",
+    )
+    parser.add_argument("profiles", nargs="*")
+    return parser.parse_args()
+
+
+def main() -> None:
+    args = parse_args()
+    if len(args.profiles) == 0:
+        profiles = parse_readme()
+    else:
+        profiles = args.profiles
+
+    failed_profiles = []
+
+    def eval_finished(args: Tuple[str, subprocess.CompletedProcess]) -> None:
+        profile, res = args
+        if res.returncode == 0:
+            print(f"{GREEN}OK {profile}{RESET}")
+        else:
+            print(f"{RED}FAIL {profile}:{RESET}", file=sys.stderr)
+            if res.stdout != "":
+                print(f"{RED}{res.stdout.rstrip()}{RESET}", file=sys.stderr)
+            print(f"{RED}{res.stderr.rstrip()}{RESET}", file=sys.stderr)
+            failed_profiles.append(profile)
+
+    if len(profiles) == 0 or args.jobs == 1:
+        for profile in profiles:
+            eval_finished(build_profile(profile))
+    else:
+        pool = multiprocessing.Pool(processes=args.jobs)
+        for r in pool.imap(build_profile, profiles):
+            eval_finished(r)
+    if len(failed_profiles) > 0:
+        print(f"\n{RED}The following {len(failed_profiles)} test(s) failed:{RESET}")
+        for profile in failed_profiles:
+            print(f"{sys.argv[0]} '{profile}'")
+        sys.exit(1)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/modules/nixos-hardware/toshiba/swanky/default.nix b/modules/nixos-hardware/toshiba/swanky/default.nix
index 9504d147db00..8361df66e53f 100644
--- a/modules/nixos-hardware/toshiba/swanky/default.nix
+++ b/modules/nixos-hardware/toshiba/swanky/default.nix
@@ -13,9 +13,6 @@ in
     ../../common/pc/laptop
   ];
 
-  # Sound only properly works out of the box on 4.18+ kernels.
-  boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
-
   # Required for screen brightness control:
   boot.kernelParams = [ "acpi_backlight=vendor" ];
 
diff --git a/modules/nixos-hardware/tuxedo/infinitybook/v4/default.nix b/modules/nixos-hardware/tuxedo/infinitybook/v4/default.nix
new file mode 100644
index 000000000000..36450bf52680
--- /dev/null
+++ b/modules/nixos-hardware/tuxedo/infinitybook/v4/default.nix
@@ -0,0 +1,5 @@
+{
+  boot.kernelParams = [
+    "i8042.reset"
+  ];
+}