From 03df3d2d530a69fe1d006c1a161f76885d3ffb2a Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 15:22:06 +1300 Subject: [PATCH 01/39] Move files around... - "kernel" and "repos.nix" --> "common/" - "firmware/surface-go/ath10k" --> "surface-go/firmware/ath10k" - Update where "kernel", "firmware/surface-go" and "repos.nix" can be found --- microsoft/surface/common/default.nix | 7 +++++++ microsoft/surface/{ => common}/kernel/default.nix | 0 .../{ => common}/kernel/linux-5.19.17/default.nix | 0 .../{ => common}/kernel/linux-5.19.17/patches.nix | 0 .../{ => common}/kernel/linux-6.0.11/default.nix | 0 .../kernel/linux-6.1.3}/patches.nix | 12 ++++++++---- .../surface/{ => common}/kernel/linux-package.nix | 0 microsoft/surface/{ => common}/repos.nix | 0 microsoft/surface/default.nix | 4 ++-- .../firmware}/ath10k/ath10k-replace.nix | 2 +- .../firmware}/ath10k/default.nix | 0 11 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 microsoft/surface/common/default.nix rename microsoft/surface/{ => common}/kernel/default.nix (100%) rename microsoft/surface/{ => common}/kernel/linux-5.19.17/default.nix (100%) rename microsoft/surface/{ => common}/kernel/linux-5.19.17/patches.nix (100%) rename microsoft/surface/{ => common}/kernel/linux-6.0.11/default.nix (100%) rename microsoft/surface/{kernel/linux-6.0.11 => common/kernel/linux-6.1.3}/patches.nix (94%) rename microsoft/surface/{ => common}/kernel/linux-package.nix (100%) rename microsoft/surface/{ => common}/repos.nix (100%) rename microsoft/surface/{firmware/surface-go => surface-go/firmware}/ath10k/ath10k-replace.nix (93%) rename microsoft/surface/{firmware/surface-go => surface-go/firmware}/ath10k/default.nix (100%) diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix new file mode 100644 index 0000000..d7e1cfa --- /dev/null +++ b/microsoft/surface/common/default.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./kernel + ]; +} diff --git a/microsoft/surface/kernel/default.nix b/microsoft/surface/common/kernel/default.nix similarity index 100% rename from microsoft/surface/kernel/default.nix rename to microsoft/surface/common/kernel/default.nix diff --git a/microsoft/surface/kernel/linux-5.19.17/default.nix b/microsoft/surface/common/kernel/linux-5.19.17/default.nix similarity index 100% rename from microsoft/surface/kernel/linux-5.19.17/default.nix rename to microsoft/surface/common/kernel/linux-5.19.17/default.nix diff --git a/microsoft/surface/kernel/linux-5.19.17/patches.nix b/microsoft/surface/common/kernel/linux-5.19.17/patches.nix similarity index 100% rename from microsoft/surface/kernel/linux-5.19.17/patches.nix rename to microsoft/surface/common/kernel/linux-5.19.17/patches.nix diff --git a/microsoft/surface/kernel/linux-6.0.11/default.nix b/microsoft/surface/common/kernel/linux-6.0.11/default.nix similarity index 100% rename from microsoft/surface/kernel/linux-6.0.11/default.nix rename to microsoft/surface/common/kernel/linux-6.0.11/default.nix diff --git a/microsoft/surface/kernel/linux-6.0.11/patches.nix b/microsoft/surface/common/kernel/linux-6.1.3/patches.nix similarity index 94% rename from microsoft/surface/kernel/linux-6.0.11/patches.nix rename to microsoft/surface/common/kernel/linux-6.1.3/patches.nix index e111c26..7b0d096 100644 --- a/microsoft/surface/kernel/linux-6.0.11/patches.nix +++ b/microsoft/surface/common/kernel/linux-6.1.3/patches.nix @@ -111,8 +111,12 @@ name = "ms-surface/0009-cameras"; patch = patchDir + "/0009-cameras.patch"; } - # { - # name = "ms-surface/0010-amd-gpio"; - # patch = patchDir + "/0010-amd-gpio.patch"; - # } + { + name = "ms-surface/0010-amd-gpio"; + patch = patchDir + "/0010-amd-gpio.patch"; + } + { + name = "ms-surface/0011-rtc"; + patch = patchDir + "/0011-rtc.patch"; + } ] diff --git a/microsoft/surface/kernel/linux-package.nix b/microsoft/surface/common/kernel/linux-package.nix similarity index 100% rename from microsoft/surface/kernel/linux-package.nix rename to microsoft/surface/common/kernel/linux-package.nix diff --git a/microsoft/surface/repos.nix b/microsoft/surface/common/repos.nix similarity index 100% rename from microsoft/surface/repos.nix rename to microsoft/surface/common/repos.nix diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 2952dae..795262b 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -5,8 +5,8 @@ let in { imports = [ - ./kernel - ./firmware/surface-go/ath10k + ./common + ./surface-go/firmware/ath10k ]; microsoft-surface.kernelVersion = mkDefault "6.0.11"; diff --git a/microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix b/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix similarity index 93% rename from microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix rename to microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix index e6b84e1..6cc55fa 100644 --- a/microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix +++ b/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix @@ -1,7 +1,7 @@ { stdenv, lib, pkgs, firmwareLinuxNonfree, ... }: let - repos = pkgs.callPackage ../../../repos.nix {}; + repos = pkgs.callPackage ../../../common/repos.nix {}; killernetworking_firmware = repos.surface-go-ath10k-firmware_backup + "/K1535_Debian"; in stdenv.mkDerivation { diff --git a/microsoft/surface/firmware/surface-go/ath10k/default.nix b/microsoft/surface/surface-go/firmware/ath10k/default.nix similarity index 100% rename from microsoft/surface/firmware/surface-go/ath10k/default.nix rename to microsoft/surface/surface-go/firmware/ath10k/default.nix From 5e6d5f2d8826fcd28dc164a9cc88120d81fc406f Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 15:35:48 +1300 Subject: [PATCH 02/39] Doc comment --- microsoft/surface/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 795262b..7b5e4bd 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -19,6 +19,7 @@ in { options iwldvm force_cam=N ''; + # Seems to be required to properly enable S0ix "Modern Standby": boot.kernelParams = [ "mem_sleep_default=deep" ]; # NOTE: Check the README before enabling TLP: From 51122e95a1a79a076cbbaea572cca0f20e6c23d9 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 15:43:25 +1300 Subject: [PATCH 03/39] Extract _actually_ common code out of microsoft/surface/default.nix --- microsoft/surface/common/default.nix | 19 +++++++++++++++++-- microsoft/surface/default.nix | 12 ------------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index d7e1cfa..95d83a0 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -1,7 +1,22 @@ -{ ... }: +{ lib, ... }: -{ +let + inherit (lib) mkDefault; + +in { imports = [ ./kernel ]; + + microsoft-surface.kernelVersion = mkDefault "6.0.11"; + + # Seems to be required to properly enable S0ix "Modern Standby": + boot.kernelParams = mkDefault [ "mem_sleep_default=deep" ]; + + # NOTE: Check the README before enabling TLP: + services.tlp.enable = mkDefault false; + + # i.e. needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364 + hardware.enableRedistributableFirmware = mkDefault true; + hardware.sensor.iio.enable = mkDefault true; } diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 7b5e4bd..e1befef 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -9,8 +9,6 @@ in { ./surface-go/firmware/ath10k ]; - microsoft-surface.kernelVersion = mkDefault "6.0.11"; - boot.extraModprobeConfig = mkDefault '' options i915 enable_fbc=1 enable_rc6=1 modeset=1 options snd_hda_intel power_save=1 @@ -19,16 +17,6 @@ in { options iwldvm force_cam=N ''; - # Seems to be required to properly enable S0ix "Modern Standby": - boot.kernelParams = [ "mem_sleep_default=deep" ]; - - # NOTE: Check the README before enabling TLP: - services.tlp.enable = mkDefault false; - - # i.e. needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364 - hardware.enableRedistributableFirmware = mkDefault true; - hardware.sensor.iio.enable = mkDefault true; - environment.systemPackages = [ pkgs.surface-control ]; From 0ce988ea8a1d9fbc61128cf8d31b45af4b3d0138 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 15:59:44 +1300 Subject: [PATCH 04/39] Extract IPTSd management into new option-enabled module --- microsoft/surface/common/default.nix | 1 + microsoft/surface/common/ipts/default.nix | 27 +++++++++++++++++++++++ microsoft/surface/default.nix | 8 +------ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 microsoft/surface/common/ipts/default.nix diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index 95d83a0..cf83775 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -6,6 +6,7 @@ let in { imports = [ ./kernel + ./ipts ]; microsoft-surface.kernelVersion = mkDefault "6.0.11"; diff --git a/microsoft/surface/common/ipts/default.nix b/microsoft/surface/common/ipts/default.nix new file mode 100644 index 0000000..4faf49e --- /dev/null +++ b/microsoft/surface/common/ipts/default.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkDefault mkEnableOption mkIf mkMerge; + + cfg = config.microsoft-surface.ipts; + +in { + options.microsoft-surface.ipts = { + enable = mkEnableOption "Enable IPTSd for Microsoft Surface"; + }; + + config = mkMerge [ + { + microsoft-surface.ipts.enable = mkDefault false; + } + + (mkIf cfg.enable { + systemd.services.iptsd = { + description = "IPTSD"; + path = with pkgs; [ iptsd ]; + script = "iptsd"; + wantedBy = [ "multi-user.target" ]; + }; + }) + ]; +} diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index e1befef..6b84749 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -25,11 +25,5 @@ in { pkgs.surface-control ]; - systemd.services.iptsd = { - description = "IPTSD"; - script = "${pkgs.iptsd}/bin/iptsd"; - wantedBy = [ - "multi-user.target" - ]; - }; + microsoft-surface.ipts.enable = true; } From f0835cb45cefc30b629c5ebbc99b04f305104562 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:04:46 +1300 Subject: [PATCH 05/39] Extract "surface-control" management into new option-enabled module --- microsoft/surface/common/default.nix | 1 + .../common/surface-control/default.nix | 25 +++++++++++++++++++ microsoft/surface/default.nix | 9 +------ 3 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 microsoft/surface/common/surface-control/default.nix diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index cf83775..8c1fd83 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -7,6 +7,7 @@ in { imports = [ ./kernel ./ipts + ./surface-control ]; microsoft-surface.kernelVersion = mkDefault "6.0.11"; diff --git a/microsoft/surface/common/surface-control/default.nix b/microsoft/surface/common/surface-control/default.nix new file mode 100644 index 0000000..4927c24 --- /dev/null +++ b/microsoft/surface/common/surface-control/default.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + + +let + inherit (lib) mkDefault mkEnableOption mkIf mkMerge; + + cfg = config.microsoft-surface.surface-control; + +in { + options.microsoft-surface.surface-control = { + enable = mkEnableOption "Enable 'surface-control' for Microsoft Surface"; + }; + + config = mkMerge [ + { + microsoft-surface.surface-control.enable = mkDefault false; + } + + (mkIf cfg.enable { + environment.systemPackages = with pkgs; [ surface-control ]; + services.udev.packages = with pkgs; [ surface-control]; + users.groups.surface-control = { }; + }) + ]; +} diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 6b84749..5b541c9 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -17,13 +17,6 @@ in { options iwldvm force_cam=N ''; - environment.systemPackages = [ - pkgs.surface-control - ]; - users.groups.surface-control = { }; - services.udev.packages = [ - pkgs.surface-control - ]; - + microsoft-surface.surface-control.enable = true; microsoft-surface.ipts.enable = true; } From ab0c9fe7ce53dca2cd870cfa57b45dd912c03800 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:13:38 +1300 Subject: [PATCH 06/39] Move the last of the code into ./microsoft/common/old --- microsoft/surface/default.nix | 14 +------------- microsoft/surface/old/default.nix | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 microsoft/surface/old/default.nix diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 5b541c9..0633c4e 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -5,18 +5,6 @@ let in { imports = [ - ./common - ./surface-go/firmware/ath10k + ./old ]; - - boot.extraModprobeConfig = mkDefault '' - options i915 enable_fbc=1 enable_rc6=1 modeset=1 - options snd_hda_intel power_save=1 - options snd_ac97_codec power_save=1 - options iwlwifi power_save=Y - options iwldvm force_cam=N - ''; - - microsoft-surface.surface-control.enable = true; - microsoft-surface.ipts.enable = true; } diff --git a/microsoft/surface/old/default.nix b/microsoft/surface/old/default.nix new file mode 100644 index 0000000..d8a2d67 --- /dev/null +++ b/microsoft/surface/old/default.nix @@ -0,0 +1,22 @@ +{ lib, pkgs, ... }: + +let + inherit (lib) mkDefault; + +in { + imports = [ + ../common + ../surface-go/firmware/ath10k + ]; + + boot.extraModprobeConfig = mkDefault '' + options i915 enable_fbc=1 enable_rc6=1 modeset=1 + options snd_hda_intel power_save=1 + options snd_ac97_codec power_save=1 + options iwlwifi power_save=Y + options iwldvm force_cam=N + ''; + + microsoft-surface.surface-control.enable = true; + microsoft-surface.ipts.enable = true; +} From fb5ac7720795bfd8414be4594a5a07e64725049c Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:27:28 +1300 Subject: [PATCH 07/39] Add warning when importing microsoft/surface/ from now on --- microsoft/surface/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 0633c4e..63aac11 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -1,10 +1,12 @@ -{ lib, pkgs, ... }: +{ lib, ... }: let - inherit (lib) mkDefault; + inherit (lib) warn; in { imports = [ - ./old + ( warn + "Please don't import microsoft/surface/ (default.nix) any longer; use microsoft/surface/old or see microsoft/surface/old/README.md for more details." + ./old ) ]; } From 6518a931507a4670bf8cdf78ef60168a1142e725 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:30:15 +1300 Subject: [PATCH 08/39] Update README.md and flake.nix --- README.md | 1 + flake.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 5ff1c15..aca0101 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,7 @@ See code for all available configurations. | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | | [Microsoft Surface Range](microsoft/surface) | `` | +| [Microsoft Surface Range (Old Behaviour)](microsoft/surface/old) | `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | | [Panasonic Let's Note CF-LX4 ](panasonic/letsnote/cf-lx4) | `` | diff --git a/flake.nix b/flake.nix index 67aeeb4..82d769b 100644 --- a/flake.nix +++ b/flake.nix @@ -131,6 +131,7 @@ lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; microsoft-surface = import ./microsoft/surface; + microsoft-surface-old-behaviour = import ./microsoft/surface/old; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; msi-gl62 = import ./msi/gl62; From 330cdaa125bd8856d316e0c01428cbaee80be90a Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:55:23 +1300 Subject: [PATCH 09/39] README.md --- microsoft/surface/old/README.md | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 microsoft/surface/old/README.md diff --git a/microsoft/surface/old/README.md b/microsoft/surface/old/README.md new file mode 100644 index 0000000..a61fc5f --- /dev/null +++ b/microsoft/surface/old/README.md @@ -0,0 +1,51 @@ +# Changes to the microsoft/surface top-level + +## Overview + +When I (@mexisme) created the microsoft/surface profile, there weren't that many differences between +the various models of Surface. + +I had just acquired a Surface Go 1, and it was mostly safe to enable all the options for all the +models, and they would fail gracefully enough that we could mostly ignore warnings or errors. + +Now, however --- as-of 2023-01-10 --- we have a much wider variety of chipsets, incl. models with +some of the newer AMD CPUs, and this is breaking small things in annoying ways for more people. + +## Changes + +### Model Specialisations + +In keeping with the broader structure of "nixos-hardware", I've also changed the structure of the +microsoft/surface profile to make it easier for people to specialise for their hardware. + +Any code or modules that are specialised for a Surface model now have their own directory under this +top-level. + +E.g. I am moving the Surface Go specialisations into `surface-go/`, and there may be further +specialisations like `surface-go-3/`. + +### "Common" modules + +All the "common" modules that were once in the top-level of the microsoft/surface profile have moved +under the `common/` directory. + +Tools / services that are shared among several models are now extracted to their own module under +`common/` and imported by `common/default.nix`. +These new "common" modules now have an `enable` option, which is `false` by default. + +### "Old Behaviour" module + +The original `./default.nix` module has been replaced by a new `old/` module, which replicates the +original behaviour. + +The new `./default.nix` will load the new `old/` module, but will also pop-up a warning asking users +to update how they use the microsoft/surface profile from now on. +This warning will probably change to a fail assertion at some point in the future. + +## Adding a new Model Specialisation + +This hasn't been finalised, partly as I now only have access to a Surface Go 1, these days, so I'm +maybe not the best custodian of this code any longer. + +However, hopefully the (imminent) `surface-go/` module is a reasonable exmample, and we should be +able to gather more examples for more model specialisations over time. From 36f3e30fff4c45d2b56e5b0e55b7a8157aab2633 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:57:32 +1300 Subject: [PATCH 10/39] README.md --- microsoft/surface/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index 458120f..57a35bd 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -1,3 +1,8 @@ +# NOTE: Structure changes from 2023-01-10 + +Please read the [Old Behaviour README](./old/README.md) to understand how some structural changes to +the code might affect you! + # Derivatives for Microsoft Surface notebooks These derivatives use the patches from the [linux-surface repo](https://github.com/linux-surface/linux-surface/tree/master/patches). From 210e621c62d00bed1e9e4d4839a39ce2e4f4e237 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 17:17:07 +1300 Subject: [PATCH 11/39] Create model specialisation for MS Surface Go --- microsoft/surface/surface-go/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 microsoft/surface/surface-go/default.nix diff --git a/microsoft/surface/surface-go/default.nix b/microsoft/surface/surface-go/default.nix new file mode 100644 index 0000000..6bfa33b --- /dev/null +++ b/microsoft/surface/surface-go/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkDefault mkEnableOption mkIf mkMerge; +in { + imports = [ + ../common + ./firmware/ath10k + ]; + + boot.extraModprobeConfig = mkDefault '' + options i915 enable_fbc=1 enable_rc6=1 modeset=1 + options snd_hda_intel power_save=1 + options snd_ac97_codec power_save=1 + options iwlwifi power_save=Y + options iwldvm force_cam=N + ''; +} From d8df3d756af19a4889c50cd5eb8276795e79454d Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 17:18:47 +1300 Subject: [PATCH 12/39] Update README.md and flake.nix --- README.md | 1 + flake.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index aca0101..31e3533 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,7 @@ See code for all available configurations. | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | | [Microsoft Surface Range](microsoft/surface) | `` | +| [Microsoft Surface Go](microsoft/surface/surface-go) | `` | | [Microsoft Surface Range (Old Behaviour)](microsoft/surface/old) | `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | diff --git a/flake.nix b/flake.nix index 82d769b..eb538c8 100644 --- a/flake.nix +++ b/flake.nix @@ -131,6 +131,7 @@ lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; microsoft-surface = import ./microsoft/surface; + microsoft-surface-go = import ./microsoft/surface/surface-go; microsoft-surface-old-behaviour = import ./microsoft/surface/old; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; From cca014c8b07818dcf5d47bdb9fe908c505097c88 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 17:19:58 +1300 Subject: [PATCH 13/39] Fix README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aca0101..b0fa76e 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ See code for all available configurations. | [MSI GS60 2QE](msi/gs60) | `` | | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | -| [Microsoft Surface Range](microsoft/surface) | `` | +| [Microsoft Surface Range (Deprecated version)](microsoft/surface) | `` | | [Microsoft Surface Range (Old Behaviour)](microsoft/surface/old) | `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | From bd17dc47068f10ee794da890092c5db5e265594e Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 15:22:06 +1300 Subject: [PATCH 14/39] Move files around... - "kernel" and "repos.nix" --> "common/" - "firmware/surface-go/ath10k" --> "surface-go/firmware/ath10k" - Update where "kernel", "firmware/surface-go" and "repos.nix" can be found --- microsoft/surface/common/default.nix | 7 ++ .../surface/{ => common}/kernel/default.nix | 0 .../kernel/linux-5.19.17/default.nix | 0 .../kernel/linux-5.19.17/patches.nix | 0 .../kernel/linux-6.0.11/default.nix | 0 .../{ => common}/kernel/linux-package.nix | 0 microsoft/surface/{ => common}/repos.nix | 0 microsoft/surface/default.nix | 4 +- .../surface/kernel/linux-6.0.11/patches.nix | 118 ------------------ .../firmware}/ath10k/ath10k-replace.nix | 2 +- .../firmware}/ath10k/default.nix | 0 11 files changed, 10 insertions(+), 121 deletions(-) create mode 100644 microsoft/surface/common/default.nix rename microsoft/surface/{ => common}/kernel/default.nix (100%) rename microsoft/surface/{ => common}/kernel/linux-5.19.17/default.nix (100%) rename microsoft/surface/{ => common}/kernel/linux-5.19.17/patches.nix (100%) rename microsoft/surface/{ => common}/kernel/linux-6.0.11/default.nix (100%) rename microsoft/surface/{ => common}/kernel/linux-package.nix (100%) rename microsoft/surface/{ => common}/repos.nix (100%) delete mode 100644 microsoft/surface/kernel/linux-6.0.11/patches.nix rename microsoft/surface/{firmware/surface-go => surface-go/firmware}/ath10k/ath10k-replace.nix (93%) rename microsoft/surface/{firmware/surface-go => surface-go/firmware}/ath10k/default.nix (100%) diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix new file mode 100644 index 0000000..d7e1cfa --- /dev/null +++ b/microsoft/surface/common/default.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./kernel + ]; +} diff --git a/microsoft/surface/kernel/default.nix b/microsoft/surface/common/kernel/default.nix similarity index 100% rename from microsoft/surface/kernel/default.nix rename to microsoft/surface/common/kernel/default.nix diff --git a/microsoft/surface/kernel/linux-5.19.17/default.nix b/microsoft/surface/common/kernel/linux-5.19.17/default.nix similarity index 100% rename from microsoft/surface/kernel/linux-5.19.17/default.nix rename to microsoft/surface/common/kernel/linux-5.19.17/default.nix diff --git a/microsoft/surface/kernel/linux-5.19.17/patches.nix b/microsoft/surface/common/kernel/linux-5.19.17/patches.nix similarity index 100% rename from microsoft/surface/kernel/linux-5.19.17/patches.nix rename to microsoft/surface/common/kernel/linux-5.19.17/patches.nix diff --git a/microsoft/surface/kernel/linux-6.0.11/default.nix b/microsoft/surface/common/kernel/linux-6.0.11/default.nix similarity index 100% rename from microsoft/surface/kernel/linux-6.0.11/default.nix rename to microsoft/surface/common/kernel/linux-6.0.11/default.nix diff --git a/microsoft/surface/kernel/linux-package.nix b/microsoft/surface/common/kernel/linux-package.nix similarity index 100% rename from microsoft/surface/kernel/linux-package.nix rename to microsoft/surface/common/kernel/linux-package.nix diff --git a/microsoft/surface/repos.nix b/microsoft/surface/common/repos.nix similarity index 100% rename from microsoft/surface/repos.nix rename to microsoft/surface/common/repos.nix diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 2952dae..795262b 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -5,8 +5,8 @@ let in { imports = [ - ./kernel - ./firmware/surface-go/ath10k + ./common + ./surface-go/firmware/ath10k ]; microsoft-surface.kernelVersion = mkDefault "6.0.11"; diff --git a/microsoft/surface/kernel/linux-6.0.11/patches.nix b/microsoft/surface/kernel/linux-6.0.11/patches.nix deleted file mode 100644 index e111c26..0000000 --- a/microsoft/surface/kernel/linux-6.0.11/patches.nix +++ /dev/null @@ -1,118 +0,0 @@ -{ kernel, - patchDir, - version, -}: - -[ - { - name = "microsoft-surface-patches-linux-${version}"; - patch = null; - structuredExtraConfig = with kernel; { - # - # Surface Aggregator Module - # - CONFIG_SURFACE_AGGREGATOR = module; - CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION = no; - CONFIG_SURFACE_AGGREGATOR_BUS = yes; - CONFIG_SURFACE_AGGREGATOR_CDEV = module; - CONFIG_SURFACE_AGGREGATOR_HUB = module; - CONFIG_SURFACE_AGGREGATOR_REGISTRY = module; - CONFIG_SURFACE_AGGREGATOR_TABLET_SWITCH = module; - - CONFIG_SURFACE_ACPI_NOTIFY = module; - CONFIG_SURFACE_DTX = module; - CONFIG_SURFACE_PLATFORM_PROFILE = module; - - CONFIG_SURFACE_HID = module; - CONFIG_SURFACE_KBD = module; - - CONFIG_BATTERY_SURFACE = module; - CONFIG_CHARGER_SURFACE = module; - - # - # Surface Hotplug - # - CONFIG_SURFACE_HOTPLUG = module; - - # - # IPTS touchscreen - # - # This only enables the user interface for IPTS data. - # For the touchscreen to work, you need to install iptsd. - # - CONFIG_MISC_IPTS = module; - - # - # Cameras: IPU3 - # - CONFIG_VIDEO_DW9719 = module; - CONFIG_VIDEO_IPU3_IMGU = module; - CONFIG_VIDEO_IPU3_CIO2 = module; - CONFIG_CIO2_BRIDGE = yes; - CONFIG_INTEL_SKL_INT3472 = module; - CONFIG_REGULATOR_TPS68470 = module; - CONFIG_COMMON_CLK_TPS68470 = module; - - # - # Cameras: Sensor drivers - # - CONFIG_VIDEO_OV5693 = module; - CONFIG_VIDEO_OV7251 = module; - CONFIG_VIDEO_OV8865 = module; - - # - # ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 - # - CONFIG_APDS9960 = module; - - # - # Other Drivers - # - CONFIG_INPUT_SOC_BUTTON_ARRAY = module; - CONFIG_SURFACE_3_POWER_OPREGION = module; - CONFIG_SURFACE_PRO3_BUTTON = module; - CONFIG_SURFACE_GPE = module; - CONFIG_SURFACE_BOOK1_DGPU_SWITCH = module; - }; - } - { - name = "ms-surface/0001-surface3-oemb"; - patch = patchDir + "/0001-surface3-oemb.patch"; - } - { - name = "ms-surface/0002-mwifiex"; - patch = patchDir + "/0002-mwifiex.patch"; - } - { - name = "ms-surface/0003-ath10k"; - patch = patchDir + "/0003-ath10k.patch"; - } - { - name = "ms-surface/0004-ipts"; - patch = patchDir + "/0004-ipts.patch"; - } - { - name = "ms-surface/0005-surface-sam"; - patch = patchDir + "/0005-surface-sam.patch"; - } - { - name = "ms-surface/0006-surface-sam-over-hid"; - patch = patchDir + "/0006-surface-sam-over-hid.patch"; - } - { - name = "ms-surface/0007-surface-button"; - patch = patchDir + "/0007-surface-button.patch"; - } - { - name = "ms-surface/0008-surface-typecover"; - patch = patchDir + "/0008-surface-typecover.patch"; - } - { - name = "ms-surface/0009-cameras"; - patch = patchDir + "/0009-cameras.patch"; - } - # { - # name = "ms-surface/0010-amd-gpio"; - # patch = patchDir + "/0010-amd-gpio.patch"; - # } -] diff --git a/microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix b/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix similarity index 93% rename from microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix rename to microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix index e6b84e1..6cc55fa 100644 --- a/microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix +++ b/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix @@ -1,7 +1,7 @@ { stdenv, lib, pkgs, firmwareLinuxNonfree, ... }: let - repos = pkgs.callPackage ../../../repos.nix {}; + repos = pkgs.callPackage ../../../common/repos.nix {}; killernetworking_firmware = repos.surface-go-ath10k-firmware_backup + "/K1535_Debian"; in stdenv.mkDerivation { diff --git a/microsoft/surface/firmware/surface-go/ath10k/default.nix b/microsoft/surface/surface-go/firmware/ath10k/default.nix similarity index 100% rename from microsoft/surface/firmware/surface-go/ath10k/default.nix rename to microsoft/surface/surface-go/firmware/ath10k/default.nix From 7ff6c2fd67ed586f20dc4272279820a26cb996e6 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 15:35:48 +1300 Subject: [PATCH 15/39] Doc comment --- microsoft/surface/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 795262b..7b5e4bd 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -19,6 +19,7 @@ in { options iwldvm force_cam=N ''; + # Seems to be required to properly enable S0ix "Modern Standby": boot.kernelParams = [ "mem_sleep_default=deep" ]; # NOTE: Check the README before enabling TLP: From 391211b3511b3f3a2669691cfe54480eb17f3565 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 15:43:25 +1300 Subject: [PATCH 16/39] Extract _actually_ common code out of microsoft/surface/default.nix --- microsoft/surface/common/default.nix | 19 +++++++++++++++++-- microsoft/surface/default.nix | 12 ------------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index d7e1cfa..95d83a0 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -1,7 +1,22 @@ -{ ... }: +{ lib, ... }: -{ +let + inherit (lib) mkDefault; + +in { imports = [ ./kernel ]; + + microsoft-surface.kernelVersion = mkDefault "6.0.11"; + + # Seems to be required to properly enable S0ix "Modern Standby": + boot.kernelParams = mkDefault [ "mem_sleep_default=deep" ]; + + # NOTE: Check the README before enabling TLP: + services.tlp.enable = mkDefault false; + + # i.e. needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364 + hardware.enableRedistributableFirmware = mkDefault true; + hardware.sensor.iio.enable = mkDefault true; } diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 7b5e4bd..e1befef 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -9,8 +9,6 @@ in { ./surface-go/firmware/ath10k ]; - microsoft-surface.kernelVersion = mkDefault "6.0.11"; - boot.extraModprobeConfig = mkDefault '' options i915 enable_fbc=1 enable_rc6=1 modeset=1 options snd_hda_intel power_save=1 @@ -19,16 +17,6 @@ in { options iwldvm force_cam=N ''; - # Seems to be required to properly enable S0ix "Modern Standby": - boot.kernelParams = [ "mem_sleep_default=deep" ]; - - # NOTE: Check the README before enabling TLP: - services.tlp.enable = mkDefault false; - - # i.e. needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364 - hardware.enableRedistributableFirmware = mkDefault true; - hardware.sensor.iio.enable = mkDefault true; - environment.systemPackages = [ pkgs.surface-control ]; From b8f4e971714112c72f05992bf63b3fa9cf117451 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 15:59:44 +1300 Subject: [PATCH 17/39] Extract IPTSd management into new option-enabled module --- microsoft/surface/common/default.nix | 1 + microsoft/surface/common/ipts/default.nix | 27 +++++++++++++++++++++++ microsoft/surface/default.nix | 8 +------ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 microsoft/surface/common/ipts/default.nix diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index 95d83a0..cf83775 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -6,6 +6,7 @@ let in { imports = [ ./kernel + ./ipts ]; microsoft-surface.kernelVersion = mkDefault "6.0.11"; diff --git a/microsoft/surface/common/ipts/default.nix b/microsoft/surface/common/ipts/default.nix new file mode 100644 index 0000000..4faf49e --- /dev/null +++ b/microsoft/surface/common/ipts/default.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkDefault mkEnableOption mkIf mkMerge; + + cfg = config.microsoft-surface.ipts; + +in { + options.microsoft-surface.ipts = { + enable = mkEnableOption "Enable IPTSd for Microsoft Surface"; + }; + + config = mkMerge [ + { + microsoft-surface.ipts.enable = mkDefault false; + } + + (mkIf cfg.enable { + systemd.services.iptsd = { + description = "IPTSD"; + path = with pkgs; [ iptsd ]; + script = "iptsd"; + wantedBy = [ "multi-user.target" ]; + }; + }) + ]; +} diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index e1befef..6b84749 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -25,11 +25,5 @@ in { pkgs.surface-control ]; - systemd.services.iptsd = { - description = "IPTSD"; - script = "${pkgs.iptsd}/bin/iptsd"; - wantedBy = [ - "multi-user.target" - ]; - }; + microsoft-surface.ipts.enable = true; } From 5b27563b0202d9fd70054552dcfbb2302a1dc5eb Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:04:46 +1300 Subject: [PATCH 18/39] Extract "surface-control" management into new option-enabled module --- microsoft/surface/common/default.nix | 1 + .../common/surface-control/default.nix | 25 +++++++++++++++++++ microsoft/surface/default.nix | 9 +------ 3 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 microsoft/surface/common/surface-control/default.nix diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index cf83775..8c1fd83 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -7,6 +7,7 @@ in { imports = [ ./kernel ./ipts + ./surface-control ]; microsoft-surface.kernelVersion = mkDefault "6.0.11"; diff --git a/microsoft/surface/common/surface-control/default.nix b/microsoft/surface/common/surface-control/default.nix new file mode 100644 index 0000000..4927c24 --- /dev/null +++ b/microsoft/surface/common/surface-control/default.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + + +let + inherit (lib) mkDefault mkEnableOption mkIf mkMerge; + + cfg = config.microsoft-surface.surface-control; + +in { + options.microsoft-surface.surface-control = { + enable = mkEnableOption "Enable 'surface-control' for Microsoft Surface"; + }; + + config = mkMerge [ + { + microsoft-surface.surface-control.enable = mkDefault false; + } + + (mkIf cfg.enable { + environment.systemPackages = with pkgs; [ surface-control ]; + services.udev.packages = with pkgs; [ surface-control]; + users.groups.surface-control = { }; + }) + ]; +} diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 6b84749..5b541c9 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -17,13 +17,6 @@ in { options iwldvm force_cam=N ''; - environment.systemPackages = [ - pkgs.surface-control - ]; - users.groups.surface-control = { }; - services.udev.packages = [ - pkgs.surface-control - ]; - + microsoft-surface.surface-control.enable = true; microsoft-surface.ipts.enable = true; } From cca1f04705171080e18f8f270fc98d168811054f Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:13:38 +1300 Subject: [PATCH 19/39] Move the last of the code into ./microsoft/common/old --- microsoft/surface/default.nix | 14 +------------- microsoft/surface/old/default.nix | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 microsoft/surface/old/default.nix diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 5b541c9..0633c4e 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -5,18 +5,6 @@ let in { imports = [ - ./common - ./surface-go/firmware/ath10k + ./old ]; - - boot.extraModprobeConfig = mkDefault '' - options i915 enable_fbc=1 enable_rc6=1 modeset=1 - options snd_hda_intel power_save=1 - options snd_ac97_codec power_save=1 - options iwlwifi power_save=Y - options iwldvm force_cam=N - ''; - - microsoft-surface.surface-control.enable = true; - microsoft-surface.ipts.enable = true; } diff --git a/microsoft/surface/old/default.nix b/microsoft/surface/old/default.nix new file mode 100644 index 0000000..d8a2d67 --- /dev/null +++ b/microsoft/surface/old/default.nix @@ -0,0 +1,22 @@ +{ lib, pkgs, ... }: + +let + inherit (lib) mkDefault; + +in { + imports = [ + ../common + ../surface-go/firmware/ath10k + ]; + + boot.extraModprobeConfig = mkDefault '' + options i915 enable_fbc=1 enable_rc6=1 modeset=1 + options snd_hda_intel power_save=1 + options snd_ac97_codec power_save=1 + options iwlwifi power_save=Y + options iwldvm force_cam=N + ''; + + microsoft-surface.surface-control.enable = true; + microsoft-surface.ipts.enable = true; +} From c52e0880de7100b0590dd3e3d39cbbc63ef45485 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:27:28 +1300 Subject: [PATCH 20/39] Add warning when importing microsoft/surface/ from now on --- microsoft/surface/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 0633c4e..63aac11 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -1,10 +1,12 @@ -{ lib, pkgs, ... }: +{ lib, ... }: let - inherit (lib) mkDefault; + inherit (lib) warn; in { imports = [ - ./old + ( warn + "Please don't import microsoft/surface/ (default.nix) any longer; use microsoft/surface/old or see microsoft/surface/old/README.md for more details." + ./old ) ]; } From 20cc307602f461001a6de0e33f7a773a1c2f4f0a Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:30:15 +1300 Subject: [PATCH 21/39] Update README.md and flake.nix --- README.md | 1 + flake.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 5ff1c15..aca0101 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,7 @@ See code for all available configurations. | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | | [Microsoft Surface Range](microsoft/surface) | `` | +| [Microsoft Surface Range (Old Behaviour)](microsoft/surface/old) | `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | | [Panasonic Let's Note CF-LX4 ](panasonic/letsnote/cf-lx4) | `` | diff --git a/flake.nix b/flake.nix index 67aeeb4..82d769b 100644 --- a/flake.nix +++ b/flake.nix @@ -131,6 +131,7 @@ lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; microsoft-surface = import ./microsoft/surface; + microsoft-surface-old-behaviour = import ./microsoft/surface/old; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; msi-gl62 = import ./msi/gl62; From cd560b1ec3498f0fc3c5d6b266e7c49b2677eebc Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:55:23 +1300 Subject: [PATCH 22/39] README.md --- microsoft/surface/old/README.md | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 microsoft/surface/old/README.md diff --git a/microsoft/surface/old/README.md b/microsoft/surface/old/README.md new file mode 100644 index 0000000..a61fc5f --- /dev/null +++ b/microsoft/surface/old/README.md @@ -0,0 +1,51 @@ +# Changes to the microsoft/surface top-level + +## Overview + +When I (@mexisme) created the microsoft/surface profile, there weren't that many differences between +the various models of Surface. + +I had just acquired a Surface Go 1, and it was mostly safe to enable all the options for all the +models, and they would fail gracefully enough that we could mostly ignore warnings or errors. + +Now, however --- as-of 2023-01-10 --- we have a much wider variety of chipsets, incl. models with +some of the newer AMD CPUs, and this is breaking small things in annoying ways for more people. + +## Changes + +### Model Specialisations + +In keeping with the broader structure of "nixos-hardware", I've also changed the structure of the +microsoft/surface profile to make it easier for people to specialise for their hardware. + +Any code or modules that are specialised for a Surface model now have their own directory under this +top-level. + +E.g. I am moving the Surface Go specialisations into `surface-go/`, and there may be further +specialisations like `surface-go-3/`. + +### "Common" modules + +All the "common" modules that were once in the top-level of the microsoft/surface profile have moved +under the `common/` directory. + +Tools / services that are shared among several models are now extracted to their own module under +`common/` and imported by `common/default.nix`. +These new "common" modules now have an `enable` option, which is `false` by default. + +### "Old Behaviour" module + +The original `./default.nix` module has been replaced by a new `old/` module, which replicates the +original behaviour. + +The new `./default.nix` will load the new `old/` module, but will also pop-up a warning asking users +to update how they use the microsoft/surface profile from now on. +This warning will probably change to a fail assertion at some point in the future. + +## Adding a new Model Specialisation + +This hasn't been finalised, partly as I now only have access to a Surface Go 1, these days, so I'm +maybe not the best custodian of this code any longer. + +However, hopefully the (imminent) `surface-go/` module is a reasonable exmample, and we should be +able to gather more examples for more model specialisations over time. From 9491d40621da9da9ce66cd239d7ee146510beb7e Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 16:57:32 +1300 Subject: [PATCH 23/39] README.md --- microsoft/surface/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index 458120f..57a35bd 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -1,3 +1,8 @@ +# NOTE: Structure changes from 2023-01-10 + +Please read the [Old Behaviour README](./old/README.md) to understand how some structural changes to +the code might affect you! + # Derivatives for Microsoft Surface notebooks These derivatives use the patches from the [linux-surface repo](https://github.com/linux-surface/linux-surface/tree/master/patches). From 9e1f036688f0a2abe0e2ec1504637de22c37661a Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 17:19:58 +1300 Subject: [PATCH 24/39] Fix README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aca0101..b0fa76e 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ See code for all available configurations. | [MSI GS60 2QE](msi/gs60) | `` | | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | -| [Microsoft Surface Range](microsoft/surface) | `` | +| [Microsoft Surface Range (Deprecated version)](microsoft/surface) | `` | | [Microsoft Surface Range (Old Behaviour)](microsoft/surface/old) | `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | From c1580f8d81c63ce2b3396d304f5db6fdaf782582 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 22:03:38 +1300 Subject: [PATCH 25/39] Update warning message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- microsoft/surface/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 63aac11..0d9a22f 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -6,7 +6,7 @@ let in { imports = [ ( warn - "Please don't import microsoft/surface/ (default.nix) any longer; use microsoft/surface/old or see microsoft/surface/old/README.md for more details." + "Please do not import microsoft/surface/ (default.nix) directly; use microsoft/surface/old or see microsoft/surface/old/README.md for more details." ./old ) ]; } From 157a74d8a47e46da908e1c1f22d645b2085343c1 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 22:32:40 +1300 Subject: [PATCH 26/39] "old" --> "deprecated" --- README.md | 4 ++-- flake.nix | 2 +- .../surface/{old/README.md => OLD-BEHAVIOUR-DEPRECATION.md} | 6 +++--- microsoft/surface/README.md | 2 +- microsoft/surface/default.nix | 2 +- microsoft/surface/{old => deprecated}/default.nix | 0 6 files changed, 8 insertions(+), 8 deletions(-) rename microsoft/surface/{old/README.md => OLD-BEHAVIOUR-DEPRECATION.md} (91%) rename microsoft/surface/{old => deprecated}/default.nix (100%) diff --git a/README.md b/README.md index b0fa76e..1236032 100644 --- a/README.md +++ b/README.md @@ -194,8 +194,8 @@ See code for all available configurations. | [MSI GS60 2QE](msi/gs60) | `` | | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | -| [Microsoft Surface Range (Deprecated version)](microsoft/surface) | `` | -| [Microsoft Surface Range (Old Behaviour)](microsoft/surface/old) | `` | +| [Microsoft Surface Range (Deprecated)](microsoft/surface) | `` | +| [Microsoft Surface Range (Deprecated)](microsoft/surface/deprecated)| `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | | [Panasonic Let's Note CF-LX4 ](panasonic/letsnote/cf-lx4) | `` | diff --git a/flake.nix b/flake.nix index 82d769b..233aec5 100644 --- a/flake.nix +++ b/flake.nix @@ -131,7 +131,7 @@ lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; microsoft-surface = import ./microsoft/surface; - microsoft-surface-old-behaviour = import ./microsoft/surface/old; + microsoft-surface-deprecated = import ./microsoft/surface/deprecated; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; msi-gl62 = import ./msi/gl62; diff --git a/microsoft/surface/old/README.md b/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md similarity index 91% rename from microsoft/surface/old/README.md rename to microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md index a61fc5f..1519a83 100644 --- a/microsoft/surface/old/README.md +++ b/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md @@ -33,12 +33,12 @@ Tools / services that are shared among several models are now extracted to their `common/` and imported by `common/default.nix`. These new "common" modules now have an `enable` option, which is `false` by default. -### "Old Behaviour" module +### "Deprecated Behaviour" module -The original `./default.nix` module has been replaced by a new `old/` module, which replicates the +The original `./default.nix` module has been replaced by a new `deprecated/` module, which replicates the original behaviour. -The new `./default.nix` will load the new `old/` module, but will also pop-up a warning asking users +The new `./default.nix` will load the new `deprecated/` module, but will also pop-up a warning asking users to update how they use the microsoft/surface profile from now on. This warning will probably change to a fail assertion at some point in the future. diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index 57a35bd..6238eb6 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -1,6 +1,6 @@ # NOTE: Structure changes from 2023-01-10 -Please read the [Old Behaviour README](./old/README.md) to understand how some structural changes to +Please read the [Deprecated Behaviour README](./deprecated/README.md) to understand how some structural changes to the code might affect you! # Derivatives for Microsoft Surface notebooks diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 0d9a22f..5ed9046 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -7,6 +7,6 @@ in { imports = [ ( warn "Please do not import microsoft/surface/ (default.nix) directly; use microsoft/surface/old or see microsoft/surface/old/README.md for more details." - ./old ) + ./deprecated ) ]; } diff --git a/microsoft/surface/old/default.nix b/microsoft/surface/deprecated/default.nix similarity index 100% rename from microsoft/surface/old/default.nix rename to microsoft/surface/deprecated/default.nix From f00dee1fdfe2975c5f80dbb79a4e6ff8fee1d3c0 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 23:22:29 +1300 Subject: [PATCH 27/39] Remove the "deprecated" module - It makes more sense to error-out and provide information on how to update. --- README.md | 1 - flake.nix | 1 - microsoft/surface/deprecated/default.nix | 22 ---------------------- 3 files changed, 24 deletions(-) delete mode 100644 microsoft/surface/deprecated/default.nix diff --git a/README.md b/README.md index 1236032..7fc7517 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,6 @@ See code for all available configurations. | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | | [Microsoft Surface Range (Deprecated)](microsoft/surface) | `` | -| [Microsoft Surface Range (Deprecated)](microsoft/surface/deprecated)| `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | | [Panasonic Let's Note CF-LX4 ](panasonic/letsnote/cf-lx4) | `` | diff --git a/flake.nix b/flake.nix index 233aec5..67aeeb4 100644 --- a/flake.nix +++ b/flake.nix @@ -131,7 +131,6 @@ lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; microsoft-surface = import ./microsoft/surface; - microsoft-surface-deprecated = import ./microsoft/surface/deprecated; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; msi-gl62 = import ./msi/gl62; diff --git a/microsoft/surface/deprecated/default.nix b/microsoft/surface/deprecated/default.nix deleted file mode 100644 index d8a2d67..0000000 --- a/microsoft/surface/deprecated/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ lib, pkgs, ... }: - -let - inherit (lib) mkDefault; - -in { - imports = [ - ../common - ../surface-go/firmware/ath10k - ]; - - boot.extraModprobeConfig = mkDefault '' - options i915 enable_fbc=1 enable_rc6=1 modeset=1 - options snd_hda_intel power_save=1 - options snd_ac97_codec power_save=1 - options iwlwifi power_save=Y - options iwldvm force_cam=N - ''; - - microsoft-surface.surface-control.enable = true; - microsoft-surface.ipts.enable = true; -} From 9d4505d4e11afd3c7037b74d87ace16fb047de06 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 23:05:27 +1300 Subject: [PATCH 28/39] Update README --- README.md | 2 +- flake.nix | 1 + .../surface/OLD-BEHAVIOUR-DEPRECATION.md | 10 ++++ microsoft/surface/README.md | 46 ++++++++++++++----- 4 files changed, 47 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7fc7517..3306655 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ See code for all available configurations. | [MSI GS60 2QE](msi/gs60) | `` | | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | -| [Microsoft Surface Range (Deprecated)](microsoft/surface) | `` | +| [Microsoft Surface Range (Common Modules)](microsoft/surface/common)| `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | | [Panasonic Let's Note CF-LX4 ](panasonic/letsnote/cf-lx4) | `` | diff --git a/flake.nix b/flake.nix index 67aeeb4..87acc3e 100644 --- a/flake.nix +++ b/flake.nix @@ -131,6 +131,7 @@ lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; microsoft-surface = import ./microsoft/surface; + microsoft-surface-common = import ./microsoft/surface/common; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; msi-gl62 = import ./msi/gl62; diff --git a/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md b/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md index 1519a83..e93a81d 100644 --- a/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md +++ b/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md @@ -11,6 +11,16 @@ models, and they would fail gracefully enough that we could mostly ignore warnin Now, however --- as-of 2023-01-10 --- we have a much wider variety of chipsets, incl. models with some of the newer AMD CPUs, and this is breaking small things in annoying ways for more people. +## How to update + +By preference, there will already be a specialised module for your model's configuration. + +If not, the `microsoft/surface/common/` module can also be imported directly, and the options +provided can be used in your own system's configuration. + +Alternatively, you can create a new specialisation for your model under `microsoft/surface` +configured for that model. + ## Changes ### Model Specialisations diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index 6238eb6..6b16cdf 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -1,13 +1,28 @@ # NOTE: Structure changes from 2023-01-10 -Please read the [Deprecated Behaviour README](./deprecated/README.md) to understand how some structural changes to +Please read the [Deprecated Behaviour README](./OLD-BEHAVIOUR-DEPRECATED.md) to understand how some structural changes to the code might affect you! -# Derivatives for Microsoft Surface notebooks +# Derivations for Microsoft Surface notebooks These derivatives use the patches from the [linux-surface repo](https://github.com/linux-surface/linux-surface/tree/master/patches). -## Kernel +## Importing + +By preference, there will already be a specialised module for your model's configuration. + +If not, the `microsoft/surface/common/` module can also be imported directly, and the options +provided can be used in your own system's configuration. + +Alternatively, you can create a new specialisation for your model under `microsoft/surface` +configured for that model. + +## Common Modules + +Most shared / common modules are under the [`common/`](./common/) directory. +This includes the patched kernel build modules, as well as tools and service like `IPTSd` and `surface-control`. + +### Kernel The kernel needs several patches to make it work correctly with some of the hardware on various Surface models, e.g. keyboard/trackpad, camera, wifi. @@ -16,21 +31,19 @@ Not all hardware is fully supported, but the [linux-surface feature matrix](https://github.com/linux-surface/linux-surface/wiki/Supported-Devices-and-Features#feature-matrix) provides details on which devices are supported on which types of machine. -The kernel-specific derivations are under the `kernel/` sub-directory. +The kernel-specific derivations are under the [`common/kernel/`](./common/kernel/) sub-directory. In order to simplify maintenance of the Nix code, only the most-recent kernel patch-set is expected to be maintained in this repo. _*NOTE:*_ Some built-in Kernel config items need to be set, that aren't set by default: - https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing -## Firmware, Drivers and Support Tools - -### WiFi - -For the Surface Go, please see the "Issues" sections below. +### Support Tools ### IPTS +Enable this with the `microsoft-surface.ipts.enable = true;` config option. + IPTS is used on most of the Surface range, except for Surface Go and Surface Laptop 3 (AMD version). Older kernels used specialised firmware which used a method that's no longer supported by the @@ -49,10 +62,21 @@ kernel-space driver into events for the HID / input sub-system. #### surface-control +Enable this with the `config.microsoft-surface.surface-control.enable = true;` config option. + For controlling the performance modes and other aspects of the device, the [`surface-control`](https://github.com/linux-surface/surface-control) tool is included. To be able to control the performance mode without using `sudo`, add your user to the `surface-control` group. +## Firmware and Drivers + +### WiFi on Surface Go + +For the Surface Go, please see the "Issues" sections below. + +Including the [`microsoft/surface/surface-go/firmware/ath-10k/`](./surface-go/firmware/ath-10k/) +module will replace the default firmware with the updated firmware. + # ToDo's Not Done See: [TODO.org](./TODO.org) @@ -73,8 +97,8 @@ You will see messages like "Can't ping firmware". The most effective fix to-date is to remove the `board-2.bin` file or replace it with a copy of the `board.bin` file. -The derivative in `firmware/surface-go/ath10k/` can configure this, if you set the option -`config.hardware.microsoft-surface.firmware.surface-go-ath10k.replace` to `true`. +The derivative in `surface-go/firmware/ath10k/` can configure this, with the +`config.hardware.microsoft-surface.firmware.surface-go-ath10k.replace = true` config option. _*NOTE:*_ This is destructive, as it deletes all the `board.bin` and `board-2.bin` files for the `ath10k` QCA6174 device, and replaces them with KillerNetworking's version. From ee8fef414961d3d04250a03cb5a071882f286f44 Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 00:01:21 +1300 Subject: [PATCH 29/39] Use the module assertions option, instead - Assertion (failure) when trying to use microsoft/surface/default.nix --- microsoft/surface/default.nix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 5ed9046..395e05d 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -1,12 +1,10 @@ -{ lib, ... }: +{ ... }: -let - inherit (lib) warn; - -in { - imports = [ - ( warn - "Please do not import microsoft/surface/ (default.nix) directly; use microsoft/surface/old or see microsoft/surface/old/README.md for more details." - ./deprecated ) +{ + assertions = [ + { + assertion = false; + message = "Importing microsoft/surface/ (default.nix) directly is deprecated! See microsoft/surface/OLD-BEHAVIOUR-DEPRECATED.md for more details."; + } ]; } From 63be2f98546ae64aedb8716fa6b0771903f291a3 Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 01:54:53 +1300 Subject: [PATCH 30/39] Update README.md to reference surface-go module --- microsoft/surface/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index 6b16cdf..b788752 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -10,6 +10,7 @@ These derivatives use the patches from the [linux-surface repo](https://github.c ## Importing By preference, there will already be a specialised module for your model's configuration. +e.g. The `microsoft/surface/surface-go` module configures for the Surface Go. If not, the `microsoft/surface/common/` module can also be imported directly, and the options provided can be used in your own system's configuration. From 30066d1886a111a917f82154ac90167b0042b29d Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 02:06:33 +1300 Subject: [PATCH 31/39] Tidy-up --- microsoft/surface/surface-go/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/microsoft/surface/surface-go/default.nix b/microsoft/surface/surface-go/default.nix index 6bfa33b..99041e3 100644 --- a/microsoft/surface/surface-go/default.nix +++ b/microsoft/surface/surface-go/default.nix @@ -1,7 +1,7 @@ -{ config, lib, pkgs, ... }: +{ lib, ... }: let - inherit (lib) mkDefault mkEnableOption mkIf mkMerge; + inherit (lib) mkDefault; in { imports = [ ../common From de3ec80522011e938a55c3964d9e1f8826215796 Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 02:11:52 +1300 Subject: [PATCH 32/39] Add Surface Pro (Intel) --- README.md | 3 ++- flake.nix | 3 ++- microsoft/surface/surface-pro-intel/default.nix | 12 ++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 microsoft/surface/surface-pro-intel/default.nix diff --git a/README.md b/README.md index 62d8b84..95ba159 100644 --- a/README.md +++ b/README.md @@ -193,9 +193,10 @@ See code for all available configurations. | [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `` | | [MSI GS60 2QE](msi/gs60) | `` | | [MSI GL62/CX62](msi/gl62) | `` | -| [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | | [Microsoft Surface Go](microsoft/surface/surface-go) | `` | +| [Microsoft Surface Pro (Intel)](microsoft/surface/surface-pro-intel)| ``| | [Microsoft Surface Range (Common Modules)](microsoft/surface/common)| `` | +| [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | | [Panasonic Let's Note CF-LX4 ](panasonic/letsnote/cf-lx4) | `` | diff --git a/flake.nix b/flake.nix index e5f587e..605d6cd 100644 --- a/flake.nix +++ b/flake.nix @@ -130,8 +130,9 @@ lenovo-thinkpad-z13 = import ./lenovo/thinkpad/z/z13; lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; - microsoft-surface-common = import ./microsoft/surface/common; microsoft-surface-go = import ./microsoft/surface/surface-go; + microsoft-surface-pro-intel = import ./microsoft/surface/surface-pro-intel; + microsoft-surface-common = import ./microsoft/surface/common; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; msi-gl62 = import ./msi/gl62; diff --git a/microsoft/surface/surface-pro-intel/default.nix b/microsoft/surface/surface-pro-intel/default.nix new file mode 100644 index 0000000..6ca5e5e --- /dev/null +++ b/microsoft/surface/surface-pro-intel/default.nix @@ -0,0 +1,12 @@ +{ lib, ... }: + +let + inherit (lib) mkDefault; +in { + imports = [ + ../common + ]; + + microsoft-surface.ipts.enable = true; + microsoft-surface.surface-control.enable = true; +} From 7b721546842f5f5824d736ba68c5ad87a66b36e9 Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 02:12:39 +1300 Subject: [PATCH 33/39] Update Surface Pro 3 to reference microsoft/surface/surface-pro-intel --- microsoft/surface-pro/3/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/surface-pro/3/default.nix b/microsoft/surface-pro/3/default.nix index 7e80d1d..989d53a 100644 --- a/microsoft/surface-pro/3/default.nix +++ b/microsoft/surface-pro/3/default.nix @@ -1,3 +1,3 @@ { - imports = [ ../../surface ]; + imports = [ ../../surface/surface-pro-intel ]; } From 80e8d29a9cd605f6230640f57b8f2a7833b6249f Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 02:24:06 +1300 Subject: [PATCH 34/39] Update Surface Go to depend on other PC modules - SSD - Intel Kaby Lake - Intel GPU --- microsoft/surface/surface-go/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/microsoft/surface/surface-go/default.nix b/microsoft/surface/surface-go/default.nix index 99041e3..7026c33 100644 --- a/microsoft/surface/surface-go/default.nix +++ b/microsoft/surface/surface-go/default.nix @@ -6,10 +6,18 @@ in { imports = [ ../common ./firmware/ath10k + ../../../common/pc + ../../../common/pc/ssd + ../../../common/cpu/intel + ../../../common/cpu/intel/kaby-lake + ]; + + boot.kernelParams = [ + "i915.enable_rc6=1" + "i915.modeset=1" ]; boot.extraModprobeConfig = mkDefault '' - options i915 enable_fbc=1 enable_rc6=1 modeset=1 options snd_hda_intel power_save=1 options snd_ac97_codec power_save=1 options iwlwifi power_save=Y From 42ec6296f22f224849bfeb7cb12a138b81a1ac7d Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 02:25:48 +1300 Subject: [PATCH 35/39] fixup! Update Surface Pro 3 to reference microsoft/surface/surface-pro-intel --- microsoft/surface/surface-pro-intel/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/microsoft/surface/surface-pro-intel/default.nix b/microsoft/surface/surface-pro-intel/default.nix index 6ca5e5e..21c50c8 100644 --- a/microsoft/surface/surface-pro-intel/default.nix +++ b/microsoft/surface/surface-pro-intel/default.nix @@ -5,6 +5,9 @@ let in { imports = [ ../common + ../../../common/pc + ../../../common/pc/ssd + ../../../common/cpu/intel ]; microsoft-surface.ipts.enable = true; From 8e6d03d3493bd3714e6e62c5a837f37850fc7807 Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 02:32:24 +1300 Subject: [PATCH 36/39] Update OLD-BEHAVIOUR-DEPRECATION.md --- .../surface/OLD-BEHAVIOUR-DEPRECATION.md | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md b/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md index e93a81d..516dc18 100644 --- a/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md +++ b/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md @@ -2,11 +2,11 @@ ## Overview -When I (@mexisme) created the microsoft/surface profile, there weren't that many differences between +When the microsoft/surface profile was created, there weren't that many differences between the various models of Surface. -I had just acquired a Surface Go 1, and it was mostly safe to enable all the options for all the -models, and they would fail gracefully enough that we could mostly ignore warnings or errors. +e.g. I had just acquired a Surface Go 1, and it was mostly safe to enable all the options for all the +models, and they would fail gracefully enough that you could mostly ignore warnings or errors. Now, however --- as-of 2023-01-10 --- we have a much wider variety of chipsets, incl. models with some of the newer AMD CPUs, and this is breaking small things in annoying ways for more people. @@ -31,9 +31,6 @@ microsoft/surface profile to make it easier for people to specialise for their h Any code or modules that are specialised for a Surface model now have their own directory under this top-level. -E.g. I am moving the Surface Go specialisations into `surface-go/`, and there may be further -specialisations like `surface-go-3/`. - ### "Common" modules All the "common" modules that were once in the top-level of the microsoft/surface profile have moved @@ -41,16 +38,7 @@ under the `common/` directory. Tools / services that are shared among several models are now extracted to their own module under `common/` and imported by `common/default.nix`. -These new "common" modules now have an `enable` option, which is `false` by default. - -### "Deprecated Behaviour" module - -The original `./default.nix` module has been replaced by a new `deprecated/` module, which replicates the -original behaviour. - -The new `./default.nix` will load the new `deprecated/` module, but will also pop-up a warning asking users -to update how they use the microsoft/surface profile from now on. -This warning will probably change to a fail assertion at some point in the future. +Most "common" modules now have an `enable` option, which is `false` by default. ## Adding a new Model Specialisation From 2cd5ae60b1c68dcbba0ce50d1c49d8082f88142a Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 10:48:24 +1300 Subject: [PATCH 37/39] Use URL to docs, instead of short-form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- microsoft/surface/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 395e05d..1943157 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -4,7 +4,7 @@ assertions = [ { assertion = false; - message = "Importing microsoft/surface/ (default.nix) directly is deprecated! See microsoft/surface/OLD-BEHAVIOUR-DEPRECATED.md for more details."; + message = "Importing microsoft/surface/ (default.nix) directly is deprecated! See https://github.com/NixOS/nixos-hardware/blob/master/microsoft/surface/OLD-BEHAVIOUR-DEPRECATED.md for more details."; } ]; } From 6832e876631de9212889f094d258f395adbf17cd Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 10:57:10 +1300 Subject: [PATCH 38/39] Add some doc comments --- microsoft/surface/surface-go/default.nix | 5 +++++ microsoft/surface/surface-pro-intel/default.nix | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/microsoft/surface/surface-go/default.nix b/microsoft/surface/surface-go/default.nix index 7026c33..fdd13f6 100644 --- a/microsoft/surface/surface-go/default.nix +++ b/microsoft/surface/surface-go/default.nix @@ -1,5 +1,9 @@ { lib, ... }: +# This module is intended to support the Surface Go range of devices. +# The current version of this targets the Go 1, and other versions of the device may need further +# config changes to work well. + let inherit (lib) mkDefault; in { @@ -8,6 +12,7 @@ in { ./firmware/ath10k ../../../common/pc ../../../common/pc/ssd + # The Intel CPU module auto-includes Intel's GPU: ../../../common/cpu/intel ../../../common/cpu/intel/kaby-lake ]; diff --git a/microsoft/surface/surface-pro-intel/default.nix b/microsoft/surface/surface-pro-intel/default.nix index 21c50c8..abbd531 100644 --- a/microsoft/surface/surface-pro-intel/default.nix +++ b/microsoft/surface/surface-pro-intel/default.nix @@ -1,5 +1,9 @@ { lib, ... }: +# This module is intended to support the Surface Pro range, specifically those with Intel CPUs. +# It's expected it will work equally well on many other Surface models, but they may need further +# config changes to work well. + let inherit (lib) mkDefault; in { @@ -7,6 +11,7 @@ in { ../common ../../../common/pc ../../../common/pc/ssd + # The Intel CPU module auto-includes Intel's GPU: ../../../common/cpu/intel ]; From f67688dcf5a3725bbf42746488027c8d039b9a0b Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 11:13:46 +1300 Subject: [PATCH 39/39] Add specialisation for Surface Laptop (AMD) --- README.md | 1 + flake.nix | 1 + .../surface/surface-laptop-amd/default.nix | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 microsoft/surface/surface-laptop-amd/default.nix diff --git a/README.md b/README.md index 95ba159..bd6086b 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,7 @@ See code for all available configurations. | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Go](microsoft/surface/surface-go) | `` | | [Microsoft Surface Pro (Intel)](microsoft/surface/surface-pro-intel)| ``| +| [Microsoft Surface Laptop (AMD)](microsoft/surface/surface-laptop-amd)| ``| | [Microsoft Surface Range (Common Modules)](microsoft/surface/common)| `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | | [Omen en00015p](omen/en00015p) | `` | diff --git a/flake.nix b/flake.nix index 605d6cd..d0c6457 100644 --- a/flake.nix +++ b/flake.nix @@ -132,6 +132,7 @@ letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; microsoft-surface-go = import ./microsoft/surface/surface-go; microsoft-surface-pro-intel = import ./microsoft/surface/surface-pro-intel; + microsoft-surface-laptop-amd = import ./microsoft/surface/surface-laptop-amd; microsoft-surface-common = import ./microsoft/surface/common; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; diff --git a/microsoft/surface/surface-laptop-amd/default.nix b/microsoft/surface/surface-laptop-amd/default.nix new file mode 100644 index 0000000..9a647dd --- /dev/null +++ b/microsoft/surface/surface-laptop-amd/default.nix @@ -0,0 +1,22 @@ +{ lib, ... }: + +# This module is intended to support the Surface Laptop range, specifically those with AMD CPUs. +# It's expected it will work equally well on many other Surface models, but they may need further +# config changes to work well. + +let + inherit (lib) mkDefault; +in { + imports = [ + ../common + ../../../common/pc + ../../../common/pc/ssd + ../../../common/cpu/amd + ../../../common/cpu/amd/pstate.nix + ../../../common/gpu/amd + ]; + + # Note: The IPTS module is not often required on devices with Surface Laptop 3 (AMD). + microsoft-surface.ipts.enable = true; + microsoft-surface.surface-control.enable = true; +}