From f99c9d5b1f537f60ec371a2105b7dae8073ff735 Mon Sep 17 00:00:00 2001 From: mexisme Date: Mon, 5 Dec 2022 16:01:37 +1300 Subject: [PATCH 1/4] Tidy-up --- microsoft/surface/default.nix | 28 +++++++++++++------ .../surface-go/ath10k/ath10k-replace.nix | 7 +++-- .../firmware/surface-go/ath10k/default.nix | 13 +++++---- microsoft/surface/kernel/linux-5.19.17.nix | 5 +--- microsoft/surface/repos.nix | 4 ++- 5 files changed, 36 insertions(+), 21 deletions(-) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 56dfd07..da01f16 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -1,10 +1,15 @@ -{ config, lib, pkgs, ... }: { +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkDefault; + +in { imports = [ ./kernel ./firmware/surface-go/ath10k ]; - boot.extraModprobeConfig = lib.mkDefault '' + 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 @@ -15,18 +20,25 @@ boot.kernelParams = [ "mem_sleep_default=deep" ]; # NOTE: Check the README before enabling TLP: - services.tlp.enable = lib.mkDefault false; + services.tlp.enable = mkDefault false; # i.e. needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364 - hardware.enableRedistributableFirmware = lib.mkDefault true; - hardware.sensor.iio.enable = lib.mkDefault true; + hardware.enableRedistributableFirmware = mkDefault true; + hardware.sensor.iio.enable = mkDefault true; - environment.systemPackages = with pkgs; [ surface-control ]; + environment.systemPackages = [ + pkgs.surface-control + ]; users.groups.surface-control = { }; - services.udev.packages = [ pkgs.surface-control ]; + services.udev.packages = [ + pkgs.surface-control + ]; + systemd.services.iptsd = { description = "IPTSD"; script = "${pkgs.iptsd}/bin/iptsd"; - wantedBy = [ "multi-user.target" ]; + wantedBy = [ + "multi-user.target" + ]; }; } diff --git a/microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix b/microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix index be0e4fe..e62307d 100644 --- a/microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix +++ b/microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix @@ -1,9 +1,10 @@ -{stdenv, lib, pkgs, firmwareLinuxNonfree, ...}: +{ stdenv, lib, pkgs, firmwareLinuxNonfree, ... }: + let repos = (pkgs.callPackage ../../../repos.nix {}); killernetworking_firmware = repos.surface-go-ath10k-firmware_backup + "/K1535_Debian"; -in -stdenv.mkDerivation { + +in stdenv.mkDerivation { pname = "microsoft-surface-go-firmware-linux-nonfree"; inherit (firmwareLinuxNonfree) version; src = firmwareLinuxNonfree; diff --git a/microsoft/surface/firmware/surface-go/ath10k/default.nix b/microsoft/surface/firmware/surface-go/ath10k/default.nix index b23fe2e..f861f8e 100644 --- a/microsoft/surface/firmware/surface-go/ath10k/default.nix +++ b/microsoft/surface/firmware/surface-go/ath10k/default.nix @@ -1,21 +1,24 @@ { config, lib, pkgs, ... }: + let + inherit (lib) mkDefault mkEnableOption mkIf; + cfg = config.hardware.microsoft-surface.firmware.surface-go-ath10k; -in -{ + +in { options = { hardware.microsoft-surface.firmware.surface-go-ath10k = { - replace = lib.mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.''; + replace = mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.''; }; }; - config = lib.mkIf cfg.replace { + config = mkIf cfg.replace { hardware.enableAllFirmware = true; hardware.firmware = [ (pkgs.callPackage ./ath10k-replace.nix {}) ]; - boot.extraModprobeConfig = lib.mkDefault '' + boot.extraModprobeConfig = mkDefault '' options ath10k_core skip_otp=Y ''; }; diff --git a/microsoft/surface/kernel/linux-5.19.17.nix b/microsoft/surface/kernel/linux-5.19.17.nix index 6093c9b..ddd8c91 100644 --- a/microsoft/surface/kernel/linux-5.19.17.nix +++ b/microsoft/surface/kernel/linux-5.19.17.nix @@ -1,7 +1,4 @@ -{ lib, - fetchurl, - repos, -}: +{ lib, fetchurl, repos,}: let inherit (lib) kernel; diff --git a/microsoft/surface/repos.nix b/microsoft/surface/repos.nix index 586d094..b5f3f05 100644 --- a/microsoft/surface/repos.nix +++ b/microsoft/surface/repos.nix @@ -1,4 +1,6 @@ -{ fetchFromGitHub, fetchurl }: { +{ fetchFromGitHub, fetchurl }: + +{ linux-surface = fetchFromGitHub { owner = "linux-surface"; repo = "linux-surface"; From e37520e48b3882f4ec773d2e56d41dd914cae34d Mon Sep 17 00:00:00 2001 From: mexisme Date: Mon, 5 Dec 2022 17:32:25 +1300 Subject: [PATCH 2/4] Rearrange the kernels to make them self-defining --- microsoft/surface/default.nix | 2 + microsoft/surface/kernel/default.nix | 37 ++--- microsoft/surface/kernel/linux-5.19.17.nix | 135 ---------------- .../surface/kernel/linux-5.19.17/default.nix | 153 ++++++++++++++++++ microsoft/surface/kernel/linux-package.nix | 23 +++ 5 files changed, 188 insertions(+), 162 deletions(-) delete mode 100644 microsoft/surface/kernel/linux-5.19.17.nix create mode 100644 microsoft/surface/kernel/linux-5.19.17/default.nix create mode 100644 microsoft/surface/kernel/linux-package.nix diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index da01f16..e193d2a 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -9,6 +9,8 @@ in { ./firmware/surface-go/ath10k ]; + microsoft-surface.kernel-version = mkDefault "5.19.17"; + boot.extraModprobeConfig = mkDefault '' options i915 enable_fbc=1 enable_rc6=1 modeset=1 options snd_hda_intel power_save=1 diff --git a/microsoft/surface/kernel/default.nix b/microsoft/surface/kernel/default.nix index 893f1bd..0c8dcfc 100644 --- a/microsoft/surface/kernel/default.nix +++ b/microsoft/surface/kernel/default.nix @@ -1,33 +1,16 @@ { config, lib, pkgs, ... }: -# To test the kernel build: -# nix-build -E "with import {}; (pkgs.callPackage ./. {}).boot.kernelPackages.kernel" - let - inherit (lib) kernel recurseIntoAttrs; - inherit (pkgs) buildLinux linuxPackagesFor; - repos = pkgs.callPackage ../repos.nix {}; - - linuxPackage = - { version, - modDirVersion ? version, - branch, - src, - kernelPatches ? [], - ... - }: let - buildLinux' = buildLinux { - inherit version src kernelPatches; - modDirVersion = version; - extraMeta.branch = branch; - }; - linuxPackagesFor' = linuxPackagesFor buildLinux'; - in recurseIntoAttrs linuxPackagesFor'; - - linux-5_19_17 = linuxPackage ( - pkgs.callPackage ./linux-5.19.17.nix { inherit repos; } - ); + inherit (lib) mkOption types; in { - boot.kernelPackages = linux-5_19_17; + imports = [ + ./linux-5.19.17 + ]; + + options.microsoft-surface.kernel-version = mkOption { + description = "Kernel Version to use (patched for MS Surface)"; + type = types.enum [ ]; + # default = "5.19.17"; + }; } diff --git a/microsoft/surface/kernel/linux-5.19.17.nix b/microsoft/surface/kernel/linux-5.19.17.nix deleted file mode 100644 index ddd8c91..0000000 --- a/microsoft/surface/kernel/linux-5.19.17.nix +++ /dev/null @@ -1,135 +0,0 @@ -{ lib, fetchurl, repos,}: - -let - inherit (lib) kernel; - version = "5.19.17"; - branch = "5.19"; - patches = repos.linux-surface + "/patches/${branch}"; - -in { - inherit version branch; - modDirVersion = version; - src = fetchurl { - url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz"; - sha256 = "sha256-yTuzhKl60fCk8Y5ELOApEkJyL3gCPspliyI0RUHwlIk="; - }; - - kernelPatches = [ - { - name = "microsoft-surface-patches-linux-${version}"; - patch = null; - structuredExtraConfig = with lib.kernel; { - # - # Surface Aggregator Module - # - SURFACE_AGGREGATOR = module; - SURFACE_AGGREGATOR_ERROR_INJECTION = no; - SURFACE_AGGREGATOR_BUS = yes; - SURFACE_AGGREGATOR_CDEV = module; - SURFACE_AGGREGATOR_REGISTRY = module; - - SURFACE_ACPI_NOTIFY = module; - SURFACE_DTX = module; - SURFACE_PLATFORM_PROFILE = module; - - SURFACE_HID = module; - SURFACE_KBD = module; - - BATTERY_SURFACE = module; - CHARGER_SURFACE = module; - - # - # Surface laptop 1 keyboard - # - SERIAL_DEV_BUS = yes; - SERIAL_DEV_CTRL_TTYPORT = yes; - - # - # Surface Hotplug - # - SURFACE_HOTPLUG = module; - - # - # IPTS touchscreen - # - # This only enables the user interface for IPTS data. - # For the touchscreen to work, you need to install iptsd. - # - MISC_IPTS = module; - - # - # Cameras: IPU3 - # - VIDEO_IPU3_IMGU = module; - VIDEO_IPU3_CIO2 = module; - CIO2_BRIDGE = yes; - INTEL_SKL_INT3472 = module; - - # - # Cameras: Sensor drivers - # - VIDEO_OV5693 = module; - VIDEO_OV8865 = module; - - # - # ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 - # - APDS9960 = module; - - # - # Other Drivers - # - INPUT_SOC_BUTTON_ARRAY = module; - SURFACE_3_BUTTON = module; - SURFACE_3_POWER_OPREGION = module; - SURFACE_PRO3_BUTTON = module; - SURFACE_GPE = module; - SURFACE_BOOK1_DGPU_SWITCH = module; - }; - } - { - name = "ms-surface/0001-surface3-oemb"; - patch = patches + "/0001-surface3-oemb.patch"; - } - { - name = "ms-surface/0002-mwifiex"; - patch = patches + "/0002-mwifiex.patch"; - } - { - name = "ms-surface/0003-ath10k"; - patch = patches + "/0003-ath10k.patch"; - } - { - name = "ms-surface/0004-ipts"; - patch = patches + "/0004-ipts.patch"; - } - { - name = "ms-surface/0005-surface-sam"; - patch = patches + "/0005-surface-sam.patch"; - } - { - name = "ms-surface/0006-surface-sam-over-hid"; - patch = patches + "/0006-surface-sam-over-hid.patch"; - } - { - name = "ms-surface/0007-surface-button"; - patch = patches + "/0007-surface-button.patch"; - } - { - name = "ms-surface/0008-surface-typecover"; - patch = patches + "/0008-surface-typecover.patch"; - } - { - name = "ms-surface/0009-surface-gpe"; - patch = patches + "/0009-surface-gpe.patch"; - } - { - name = "ms-surface/0010-cameras"; - patch = patches + "/0010-cameras.patch"; - } - { - name = "ms-surface/0011-amd-gpio"; - patch = patches + "/0011-amd-gpio.patch"; - } - ]; -} diff --git a/microsoft/surface/kernel/linux-5.19.17/default.nix b/microsoft/surface/kernel/linux-5.19.17/default.nix new file mode 100644 index 0000000..e1bf29d --- /dev/null +++ b/microsoft/surface/kernel/linux-5.19.17/default.nix @@ -0,0 +1,153 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) kernel mkIf mkOption types; + inherit (pkgs) fetchurl; + + inherit (pkgs.callPackage ../linux-package.nix { }) linuxPackage repos; + + cfg = config.microsoft-surface.kernel-version; + + version = "5.19.17"; + extraMeta.branch = "5.19"; + patches = repos.linux-surface + "/patches/${extraMeta.branch}"; + + kernelPackages = linuxPackage { + inherit version extraMeta; + # modDirVersion = version; + src = fetchurl { + url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz"; + sha256 = "sha256-yTuzhKl60fCk8Y5ELOApEkJyL3gCPspliyI0RUHwlIk="; + }; + + kernelPatches = [ + { + name = "microsoft-surface-patches-linux-${version}"; + patch = null; + structuredExtraConfig = with lib.kernel; { + # + # Surface Aggregator Module + # + SURFACE_AGGREGATOR = module; + SURFACE_AGGREGATOR_ERROR_INJECTION = no; + SURFACE_AGGREGATOR_BUS = yes; + SURFACE_AGGREGATOR_CDEV = module; + SURFACE_AGGREGATOR_REGISTRY = module; + + SURFACE_ACPI_NOTIFY = module; + SURFACE_DTX = module; + SURFACE_PLATFORM_PROFILE = module; + + SURFACE_HID = module; + SURFACE_KBD = module; + + BATTERY_SURFACE = module; + CHARGER_SURFACE = module; + + # + # Surface laptop 1 keyboard + # + SERIAL_DEV_BUS = yes; + SERIAL_DEV_CTRL_TTYPORT = yes; + + # + # Surface Hotplug + # + SURFACE_HOTPLUG = module; + + # + # IPTS touchscreen + # + # This only enables the user interface for IPTS data. + # For the touchscreen to work, you need to install iptsd. + # + MISC_IPTS = module; + + # + # Cameras: IPU3 + # + VIDEO_IPU3_IMGU = module; + VIDEO_IPU3_CIO2 = module; + CIO2_BRIDGE = yes; + INTEL_SKL_INT3472 = module; + + # + # Cameras: Sensor drivers + # + VIDEO_OV5693 = module; + VIDEO_OV8865 = module; + + # + # ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 + # + APDS9960 = module; + + # + # Other Drivers + # + INPUT_SOC_BUTTON_ARRAY = module; + SURFACE_3_BUTTON = module; + SURFACE_3_POWER_OPREGION = module; + SURFACE_PRO3_BUTTON = module; + SURFACE_GPE = module; + SURFACE_BOOK1_DGPU_SWITCH = module; + }; + } + { + name = "ms-surface/0001-surface3-oemb"; + patch = patches + "/0001-surface3-oemb.patch"; + } + { + name = "ms-surface/0002-mwifiex"; + patch = patches + "/0002-mwifiex.patch"; + } + { + name = "ms-surface/0003-ath10k"; + patch = patches + "/0003-ath10k.patch"; + } + { + name = "ms-surface/0004-ipts"; + patch = patches + "/0004-ipts.patch"; + } + { + name = "ms-surface/0005-surface-sam"; + patch = patches + "/0005-surface-sam.patch"; + } + { + name = "ms-surface/0006-surface-sam-over-hid"; + patch = patches + "/0006-surface-sam-over-hid.patch"; + } + { + name = "ms-surface/0007-surface-button"; + patch = patches + "/0007-surface-button.patch"; + } + { + name = "ms-surface/0008-surface-typecover"; + patch = patches + "/0008-surface-typecover.patch"; + } + { + name = "ms-surface/0009-surface-gpe"; + patch = patches + "/0009-surface-gpe.patch"; + } + { + name = "ms-surface/0010-cameras"; + patch = patches + "/0010-cameras.patch"; + } + { + name = "ms-surface/0011-amd-gpio"; + patch = patches + "/0011-amd-gpio.patch"; + } + ]; + }; + +in { + options.microsoft-surface.kernel-version = mkOption { + type = types.enum [ "5.19.17" ]; + }; + + config = mkIf (cfg == "5.19.17") { + boot = { + inherit kernelPackages; + }; + }; +} diff --git a/microsoft/surface/kernel/linux-package.nix b/microsoft/surface/kernel/linux-package.nix new file mode 100644 index 0000000..4858e4f --- /dev/null +++ b/microsoft/surface/kernel/linux-package.nix @@ -0,0 +1,23 @@ +{ lib, + buildLinux, + callPackage, + fetchurl, + linuxPackagesFor, +}: + +let + inherit (lib) kernel recurseIntoAttrs; + +in { + repos = callPackage ../repos.nix {}; + + linuxPackage = + { version, + modDirVersion ? version, + ... + } @ args: + let + buildLinux' = buildLinux (args // { inherit modDirVersion; }); + linuxPackagesFor' = linuxPackagesFor buildLinux'; + in recurseIntoAttrs linuxPackagesFor'; +} From e84ab22523d77f340594282b130ebcfbbdb93a5b Mon Sep 17 00:00:00 2001 From: mexisme Date: Mon, 5 Dec 2022 17:38:21 +1300 Subject: [PATCH 3/4] Extract the kernel patches out --- .../surface/kernel/linux-5.19.17/default.nix | 130 +----------------- .../surface/kernel/linux-5.19.17/patches.nix | 123 +++++++++++++++++ 2 files changed, 130 insertions(+), 123 deletions(-) create mode 100644 microsoft/surface/kernel/linux-5.19.17/patches.nix diff --git a/microsoft/surface/kernel/linux-5.19.17/default.nix b/microsoft/surface/kernel/linux-5.19.17/default.nix index e1bf29d..d33a43e 100644 --- a/microsoft/surface/kernel/linux-5.19.17/default.nix +++ b/microsoft/surface/kernel/linux-5.19.17/default.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: let - inherit (lib) kernel mkIf mkOption types; + inherit (lib) mkIf mkOption types; inherit (pkgs) fetchurl; inherit (pkgs.callPackage ../linux-package.nix { }) linuxPackage repos; @@ -10,134 +10,18 @@ let version = "5.19.17"; extraMeta.branch = "5.19"; - patches = repos.linux-surface + "/patches/${extraMeta.branch}"; + patchDir = repos.linux-surface + "/patches/${extraMeta.branch}"; + kernelPatches = pkgs.callPackage ./patches.nix { + inherit (lib) kernel; + inherit version patchDir; + }; kernelPackages = linuxPackage { - inherit version extraMeta; - # modDirVersion = version; + inherit version extraMeta kernelPatches; src = fetchurl { url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz"; sha256 = "sha256-yTuzhKl60fCk8Y5ELOApEkJyL3gCPspliyI0RUHwlIk="; }; - - kernelPatches = [ - { - name = "microsoft-surface-patches-linux-${version}"; - patch = null; - structuredExtraConfig = with lib.kernel; { - # - # Surface Aggregator Module - # - SURFACE_AGGREGATOR = module; - SURFACE_AGGREGATOR_ERROR_INJECTION = no; - SURFACE_AGGREGATOR_BUS = yes; - SURFACE_AGGREGATOR_CDEV = module; - SURFACE_AGGREGATOR_REGISTRY = module; - - SURFACE_ACPI_NOTIFY = module; - SURFACE_DTX = module; - SURFACE_PLATFORM_PROFILE = module; - - SURFACE_HID = module; - SURFACE_KBD = module; - - BATTERY_SURFACE = module; - CHARGER_SURFACE = module; - - # - # Surface laptop 1 keyboard - # - SERIAL_DEV_BUS = yes; - SERIAL_DEV_CTRL_TTYPORT = yes; - - # - # Surface Hotplug - # - SURFACE_HOTPLUG = module; - - # - # IPTS touchscreen - # - # This only enables the user interface for IPTS data. - # For the touchscreen to work, you need to install iptsd. - # - MISC_IPTS = module; - - # - # Cameras: IPU3 - # - VIDEO_IPU3_IMGU = module; - VIDEO_IPU3_CIO2 = module; - CIO2_BRIDGE = yes; - INTEL_SKL_INT3472 = module; - - # - # Cameras: Sensor drivers - # - VIDEO_OV5693 = module; - VIDEO_OV8865 = module; - - # - # ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 - # - APDS9960 = module; - - # - # Other Drivers - # - INPUT_SOC_BUTTON_ARRAY = module; - SURFACE_3_BUTTON = module; - SURFACE_3_POWER_OPREGION = module; - SURFACE_PRO3_BUTTON = module; - SURFACE_GPE = module; - SURFACE_BOOK1_DGPU_SWITCH = module; - }; - } - { - name = "ms-surface/0001-surface3-oemb"; - patch = patches + "/0001-surface3-oemb.patch"; - } - { - name = "ms-surface/0002-mwifiex"; - patch = patches + "/0002-mwifiex.patch"; - } - { - name = "ms-surface/0003-ath10k"; - patch = patches + "/0003-ath10k.patch"; - } - { - name = "ms-surface/0004-ipts"; - patch = patches + "/0004-ipts.patch"; - } - { - name = "ms-surface/0005-surface-sam"; - patch = patches + "/0005-surface-sam.patch"; - } - { - name = "ms-surface/0006-surface-sam-over-hid"; - patch = patches + "/0006-surface-sam-over-hid.patch"; - } - { - name = "ms-surface/0007-surface-button"; - patch = patches + "/0007-surface-button.patch"; - } - { - name = "ms-surface/0008-surface-typecover"; - patch = patches + "/0008-surface-typecover.patch"; - } - { - name = "ms-surface/0009-surface-gpe"; - patch = patches + "/0009-surface-gpe.patch"; - } - { - name = "ms-surface/0010-cameras"; - patch = patches + "/0010-cameras.patch"; - } - { - name = "ms-surface/0011-amd-gpio"; - patch = patches + "/0011-amd-gpio.patch"; - } - ]; }; in { diff --git a/microsoft/surface/kernel/linux-5.19.17/patches.nix b/microsoft/surface/kernel/linux-5.19.17/patches.nix new file mode 100644 index 0000000..86a7141 --- /dev/null +++ b/microsoft/surface/kernel/linux-5.19.17/patches.nix @@ -0,0 +1,123 @@ +{ kernel, + patchDir, + version, +}: + +[ + { + name = "microsoft-surface-patches-linux-${version}"; + patch = null; + structuredExtraConfig = with kernel; { + # + # Surface Aggregator Module + # + SURFACE_AGGREGATOR = module; + SURFACE_AGGREGATOR_ERROR_INJECTION = no; + SURFACE_AGGREGATOR_BUS = yes; + SURFACE_AGGREGATOR_CDEV = module; + SURFACE_AGGREGATOR_REGISTRY = module; + + SURFACE_ACPI_NOTIFY = module; + SURFACE_DTX = module; + SURFACE_PLATFORM_PROFILE = module; + + SURFACE_HID = module; + SURFACE_KBD = module; + + BATTERY_SURFACE = module; + CHARGER_SURFACE = module; + + # + # Surface laptop 1 keyboard + # + SERIAL_DEV_BUS = yes; + SERIAL_DEV_CTRL_TTYPORT = yes; + + # + # Surface Hotplug + # + SURFACE_HOTPLUG = module; + + # + # IPTS touchscreen + # + # This only enables the user interface for IPTS data. + # For the touchscreen to work, you need to install iptsd. + # + MISC_IPTS = module; + + # + # Cameras: IPU3 + # + VIDEO_IPU3_IMGU = module; + VIDEO_IPU3_CIO2 = module; + CIO2_BRIDGE = yes; + INTEL_SKL_INT3472 = module; + + # + # Cameras: Sensor drivers + # + VIDEO_OV5693 = module; + VIDEO_OV8865 = module; + + # + # ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 + # + APDS9960 = module; + + # + # Other Drivers + # + INPUT_SOC_BUTTON_ARRAY = module; + SURFACE_3_BUTTON = module; + SURFACE_3_POWER_OPREGION = module; + SURFACE_PRO3_BUTTON = module; + SURFACE_GPE = module; + 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-surface-gpe"; + patch = patchDir + "/0009-surface-gpe.patch"; + } + { + name = "ms-surface/0010-cameras"; + patch = patchDir + "/0010-cameras.patch"; + } + { + name = "ms-surface/0011-amd-gpio"; + patch = patchDir + "/0011-amd-gpio.patch"; + } +] From be728899cfc9c9c53910b5f1bb928c06fd6688ff Mon Sep 17 00:00:00 2001 From: mexisme Date: Mon, 5 Dec 2022 17:39:24 +1300 Subject: [PATCH 4/4] Tidy-up --- microsoft/surface/default.nix | 2 +- microsoft/surface/kernel/default.nix | 5 ++--- microsoft/surface/kernel/linux-5.19.17/default.nix | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index e193d2a..22f6c6c 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -9,7 +9,7 @@ in { ./firmware/surface-go/ath10k ]; - microsoft-surface.kernel-version = mkDefault "5.19.17"; + microsoft-surface.kernelVersion = mkDefault "5.19.17"; boot.extraModprobeConfig = mkDefault '' options i915 enable_fbc=1 enable_rc6=1 modeset=1 diff --git a/microsoft/surface/kernel/default.nix b/microsoft/surface/kernel/default.nix index 0c8dcfc..627ed3d 100644 --- a/microsoft/surface/kernel/default.nix +++ b/microsoft/surface/kernel/default.nix @@ -8,9 +8,8 @@ in { ./linux-5.19.17 ]; - options.microsoft-surface.kernel-version = mkOption { + options.microsoft-surface.kernelVersion = mkOption { description = "Kernel Version to use (patched for MS Surface)"; - type = types.enum [ ]; - # default = "5.19.17"; + type = types.enum [ ]; }; } diff --git a/microsoft/surface/kernel/linux-5.19.17/default.nix b/microsoft/surface/kernel/linux-5.19.17/default.nix index d33a43e..6cc1830 100644 --- a/microsoft/surface/kernel/linux-5.19.17/default.nix +++ b/microsoft/surface/kernel/linux-5.19.17/default.nix @@ -6,7 +6,7 @@ let inherit (pkgs.callPackage ../linux-package.nix { }) linuxPackage repos; - cfg = config.microsoft-surface.kernel-version; + cfg = config.microsoft-surface; version = "5.19.17"; extraMeta.branch = "5.19"; @@ -25,11 +25,11 @@ let }; in { - options.microsoft-surface.kernel-version = mkOption { + options.microsoft-surface.kernelVersion = mkOption { type = types.enum [ "5.19.17" ]; }; - config = mkIf (cfg == "5.19.17") { + config = mkIf (cfg.kernelVersion == "5.19.17") { boot = { inherit kernelPackages; };