Merge pull request #1681 from 8bitbuddhist/surface-kernel-simplify
Some checks failed
Test / nixfmt (push) Has been cancelled
Test / tests (push) Has been cancelled

microsoft/surface: simplify patch pulling
This commit is contained in:
Jörg Thalheim 2025-11-25 14:13:59 +00:00 committed by GitHub
commit da17006633
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 48 deletions

View file

@ -32,57 +32,23 @@ let
else else
abort "Invalid kernel version: ${kernelVersion}"; abort "Invalid kernel version: ${kernelVersion}";
# Set the version and hash for the linux-surface releases # Fetch the latest linux-surface patches
pkgVersion = linux-surface = pkgs.fetchFromGitHub {
with config.hardware.microsoft-surface; owner = "linux-surface";
if kernelVersion == "longterm" then repo = "linux-surface";
"6.12.7" rev = "50d0ed6be462a5fdb643cfe8469bf69158afae42";
else if kernelVersion == "stable" then hash = "sha256-ozvYrZDiVtMkdCcVnNEdlF2Kdw4jivW0aMJrDynN3Hk=";
"6.15.3" };
else
abort "Invalid kernel version: ${kernelVersion}";
pkgHash = # Fetch and build the kernel
with config.hardware.microsoft-surface; inherit (pkgs.callPackage ./kernel/linux-package.nix { })
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 and build the kernel package
inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; })
linuxPackage linuxPackage
surfacePatches surfacePatches
; ;
kernelPatches = surfacePatches { kernelPatches = surfacePatches {
version = pkgVersion; version = srcVersion;
patchFn = ./kernel/${versions.majorMinor pkgVersion}/patches.nix; patchFn = ./kernel/${versions.majorMinor srcVersion}/patches.nix;
patchSrc = (repos.linux-surface + "/patches/${versions.majorMinor pkgVersion}"); patchSrc = (linux-surface + "/patches/${versions.majorMinor srcVersion}");
}; };
kernelPackages = linuxPackage { kernelPackages = linuxPackage {
inherit kernelPatches; inherit kernelPatches;

View file

@ -4,7 +4,6 @@
fetchurl, fetchurl,
buildLinux, buildLinux,
linuxPackagesFor, linuxPackagesFor,
repos,
}: }:
let let
@ -74,7 +73,6 @@ in
{ {
inherit inherit
linuxPackage linuxPackage
repos
surfacePatches surfacePatches
versionsOf versionsOf
isVersionOf isVersionOf