From abb5f782d327eef1e54c5d3d23ac9edd32e46655 Mon Sep 17 00:00:00 2001 From: Andre Date: Sun, 23 Nov 2025 13:20:08 -0500 Subject: [PATCH 1/2] microsoft/surface: change logic to pull the latest linux-surface for all versions, since we really just need the patches. --- microsoft/surface/common/default.nix | 59 +++++++--------------------- 1 file changed, 15 insertions(+), 44 deletions(-) diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index 1fe46fee..91efb3e6 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -32,57 +32,28 @@ let else abort "Invalid kernel version: ${kernelVersion}"; - # Set the version and hash for the linux-surface releases - pkgVersion = - with config.hardware.microsoft-surface; - if kernelVersion == "longterm" then - "6.12.7" - else if kernelVersion == "stable" then - "6.15.3" - else - abort "Invalid kernel version: ${kernelVersion}"; - - pkgHash = - with config.hardware.microsoft-surface; - if kernelVersion == "longterm" then - "sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY=" - else if kernelVersion == "stable" then - "sha256-ozvYrZDiVtMkdCcVnNEdlF2Kdw4jivW0aMJrDynN3Hk=" - else - abort "Invalid kernel version: ${kernelVersion}"; - - # Fetch the linux-surface package - repos = - pkgs.callPackage - ( - { - fetchFromGitHub, - rev, - hash, - }: - { - linux-surface = fetchFromGitHub { - owner = "linux-surface"; - repo = "linux-surface"; - rev = rev; - hash = hash; - }; - } - ) - { - hash = pkgHash; - rev = "arch-${pkgVersion}-1"; + # Fetch the latest linux-surface patches + repos = pkgs.callPackage ( + { fetchFromGitHub }: + { + linux-surface = fetchFromGitHub { + owner = "linux-surface"; + repo = "linux-surface"; + rev = "50d0ed6be462a5fdb643cfe8469bf69158afae42"; + hash = "sha256-ozvYrZDiVtMkdCcVnNEdlF2Kdw4jivW0aMJrDynN3Hk="; }; + } + ) { }; - # Fetch and build the kernel package + # Fetch and build the kernel inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; }) linuxPackage surfacePatches ; kernelPatches = surfacePatches { - version = pkgVersion; - patchFn = ./kernel/${versions.majorMinor pkgVersion}/patches.nix; - patchSrc = (repos.linux-surface + "/patches/${versions.majorMinor pkgVersion}"); + version = srcVersion; + patchFn = ./kernel/${versions.majorMinor srcVersion}/patches.nix; + patchSrc = (repos.linux-surface + "/patches/${versions.majorMinor srcVersion}"); }; kernelPackages = linuxPackage { inherit kernelPatches; From ae4fcae9234fe60846e22186eb0fd94e1751fd54 Mon Sep 17 00:00:00 2001 From: Andre Date: Mon, 24 Nov 2025 17:47:45 -0500 Subject: [PATCH 2/2] microsoft/surface: flatten 'repos' object --- microsoft/surface/common/default.nix | 21 +++++++------------ .../surface/common/kernel/linux-package.nix | 2 -- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index 91efb3e6..78d7bbda 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -33,27 +33,22 @@ let abort "Invalid kernel version: ${kernelVersion}"; # Fetch the latest linux-surface patches - repos = pkgs.callPackage ( - { fetchFromGitHub }: - { - linux-surface = fetchFromGitHub { - owner = "linux-surface"; - repo = "linux-surface"; - rev = "50d0ed6be462a5fdb643cfe8469bf69158afae42"; - hash = "sha256-ozvYrZDiVtMkdCcVnNEdlF2Kdw4jivW0aMJrDynN3Hk="; - }; - } - ) { }; + linux-surface = pkgs.fetchFromGitHub { + owner = "linux-surface"; + repo = "linux-surface"; + rev = "50d0ed6be462a5fdb643cfe8469bf69158afae42"; + hash = "sha256-ozvYrZDiVtMkdCcVnNEdlF2Kdw4jivW0aMJrDynN3Hk="; + }; # Fetch and build the kernel - inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; }) + inherit (pkgs.callPackage ./kernel/linux-package.nix { }) linuxPackage surfacePatches ; kernelPatches = surfacePatches { version = srcVersion; patchFn = ./kernel/${versions.majorMinor srcVersion}/patches.nix; - patchSrc = (repos.linux-surface + "/patches/${versions.majorMinor srcVersion}"); + patchSrc = (linux-surface + "/patches/${versions.majorMinor srcVersion}"); }; kernelPackages = linuxPackage { inherit kernelPatches; diff --git a/microsoft/surface/common/kernel/linux-package.nix b/microsoft/surface/common/kernel/linux-package.nix index f9f96184..9dba7431 100644 --- a/microsoft/surface/common/kernel/linux-package.nix +++ b/microsoft/surface/common/kernel/linux-package.nix @@ -4,7 +4,6 @@ fetchurl, buildLinux, linuxPackagesFor, - repos, }: let @@ -74,7 +73,6 @@ in { inherit linuxPackage - repos surfacePatches versionsOf isVersionOf