|  | 
| 10 | 10 |     mkDefault | 
| 11 | 11 |     mkOption | 
| 12 | 12 |     types | 
| 13 |  | -    versions | 
| 14 | 13 |     ; | 
| 15 | 14 | 
 | 
| 16 |  | -  # Set the version and hash for the kernel sources | 
| 17 |  | -  srcVersion = | 
| 18 |  | -    with config.hardware.microsoft-surface; | 
| 19 |  | -    if kernelVersion == "longterm" then | 
| 20 |  | -      "6.12.19" | 
| 21 |  | -    else if kernelVersion == "stable" then | 
| 22 |  | -      "6.15.9" | 
| 23 |  | -    else | 
| 24 |  | -      abort "Invalid kernel version: ${kernelVersion}"; | 
| 25 |  | - | 
| 26 |  | -  srcHash = | 
| 27 |  | -    with config.hardware.microsoft-surface; | 
| 28 |  | -    if kernelVersion == "longterm" then | 
| 29 |  | -      "sha256-1zvwV77ARDSxadG2FkGTb30Ml865I6KB8y413U3MZTE=" | 
| 30 |  | -    else if kernelVersion == "stable" then | 
| 31 |  | -      "sha256-6U86+FSSMC96gZRBRY+AvKCtmRLlpMg8aZ/zxjxSlX0=" | 
| 32 |  | -    else | 
| 33 |  | -      abort "Invalid kernel version: ${kernelVersion}"; | 
| 34 |  | - | 
| 35 |  | -  # Set the version and hash for the linux-surface releases | 
| 36 |  | -  pkgVersion = | 
| 37 |  | -    with config.hardware.microsoft-surface; | 
| 38 |  | -    if kernelVersion == "longterm" then | 
| 39 |  | -      "6.12.7" | 
| 40 |  | -    else if kernelVersion == "stable" then | 
| 41 |  | -      "6.15.3" | 
| 42 |  | -    else | 
| 43 |  | -      abort "Invalid kernel version: ${kernelVersion}"; | 
| 44 |  | - | 
| 45 |  | -  pkgHash = | 
| 46 |  | -    with config.hardware.microsoft-surface; | 
| 47 |  | -    if kernelVersion == "longterm" then | 
| 48 |  | -      "sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY=" | 
| 49 |  | -    else if kernelVersion == "stable" then | 
| 50 |  | -      "sha256-ozvYrZDiVtMkdCcVnNEdlF2Kdw4jivW0aMJrDynN3Hk=" | 
| 51 |  | -    else | 
| 52 |  | -      abort "Invalid kernel version: ${kernelVersion}"; | 
| 53 |  | - | 
| 54 |  | -  # Fetch the linux-surface package | 
| 55 |  | -  repos = | 
| 56 |  | -    pkgs.callPackage | 
| 57 |  | -      ( | 
| 58 |  | -        { | 
| 59 |  | -          fetchFromGitHub, | 
| 60 |  | -          rev, | 
| 61 |  | -          hash, | 
| 62 |  | -        }: | 
| 63 |  | -        { | 
| 64 |  | -          linux-surface = fetchFromGitHub { | 
| 65 |  | -            owner = "linux-surface"; | 
| 66 |  | -            repo = "linux-surface"; | 
| 67 |  | -            rev = rev; | 
| 68 |  | -            hash = hash; | 
| 69 |  | -          }; | 
| 70 |  | -        } | 
| 71 |  | -      ) | 
| 72 |  | -      { | 
| 73 |  | -        hash = pkgHash; | 
| 74 |  | -        rev = "arch-${pkgVersion}-1"; | 
| 75 |  | -      }; | 
| 76 |  | - | 
| 77 |  | -  # Fetch and build the kernel package | 
| 78 |  | -  inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; }) | 
| 79 |  | -    linuxPackage | 
| 80 |  | -    surfacePatches | 
| 81 |  | -    ; | 
| 82 |  | -  kernelPatches = surfacePatches { | 
| 83 |  | -    version = pkgVersion; | 
| 84 |  | -    patchFn = ./kernel/${versions.majorMinor pkgVersion}/patches.nix; | 
| 85 |  | -    patchSrc = (repos.linux-surface + "/patches/${versions.majorMinor pkgVersion}"); | 
| 86 |  | -  }; | 
| 87 |  | -  kernelPackages = linuxPackage { | 
| 88 |  | -    inherit kernelPatches; | 
| 89 |  | -    version = srcVersion; | 
| 90 |  | -    sha256 = srcHash; | 
| 91 |  | -    ignoreConfigErrors = true; | 
|  | 15 | +  kernelPackages = pkgs.callPackage ../pkgs/kernel { | 
|  | 16 | +    inherit (config.hardware.microsoft-surface) kernelVersion; | 
| 92 | 17 |   }; | 
| 93 | 18 | 
 | 
| 94 | 19 | in | 
|  | 
0 commit comments