|
3 | 3 | let
|
4 | 4 | inherit (lib) mkDefault mkOption types versions;
|
5 | 5 |
|
6 |
| - # Set the full kernel version and hashes |
7 |
| - version = |
8 |
| - if config.microsoft-surface.kernelVersion == "longterm" then |
| 6 | + # Set the version and hash for the kernel sources |
| 7 | + srcVersion = with config.microsoft-surface; |
| 8 | + if kernelVersion == "longterm" then |
9 | 9 | "6.12.19"
|
10 |
| - else if config.microsoft-surface.kernelVersion == "stable" then |
| 10 | + else if kernelVersion == "stable" then |
11 | 11 | "6.13.6"
|
12 | 12 | else
|
13 |
| - abort "Invalid kernel version: ${config.microsoft-surface.kernelVersion}"; |
14 |
| - |
15 |
| - shortVersion = versions.majorMinor version; |
16 |
| - packageHash = |
17 |
| - if shortVersion == "6.12" then |
18 |
| - "sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY=" |
19 |
| - else if shortVersion == "6.13" then |
20 |
| - "sha256-otD1ckNxNnvV8xipf9SZpbfg+bBq5EPwyieYtLIV4Ck=" |
21 |
| - else |
22 |
| - abort "Invalid kernel version: ${shortVersion}"; |
| 13 | + abort "Invalid kernel version: ${kernelVersion}"; |
23 | 14 |
|
24 |
| - srcHash = |
25 |
| - if shortVersion == "6.12" then |
| 15 | + srcHash = with config.microsoft-surface; |
| 16 | + if kernelVersion == "longterm" then |
26 | 17 | "sha256-1zvwV77ARDSxadG2FkGTb30Ml865I6KB8y413U3MZTE="
|
27 |
| - else if shortVersion == "6.13" then |
| 18 | + else if kernelVersion == "stable" then |
28 | 19 | "sha256-3gBTy0E9QI8g/R1XiCGZUbikQD5drBsdkDIJCTis0Zk="
|
29 | 20 | else
|
30 |
| - abort "Invalid kernel version: ${shortVersion}"; |
| 21 | + abort "Invalid kernel version: ${kernelVersion}"; |
| 22 | + |
| 23 | + # Set the version and hash for the linux-surface releases |
| 24 | + pkgVersion = with config.microsoft-surface; |
| 25 | + if kernelVersion == "longterm" then |
| 26 | + "6.12.7" |
| 27 | + else if kernelVersion == "stable" then |
| 28 | + "6.13.6" |
| 29 | + else |
| 30 | + abort "Invalid kernel version: ${kernelVersion}"; |
| 31 | + |
| 32 | + pkgHash = with config.microsoft-surface; |
| 33 | + if kernelVersion == "longterm" then |
| 34 | + "sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY=" |
| 35 | + else if kernelVersion == "stable" then |
| 36 | + "sha256-otD1ckNxNnvV8xipf9SZpbfg+bBq5EPwyieYtLIV4Ck=" |
| 37 | + else |
| 38 | + abort "Invalid kernel version: ${kernelVersion}"; |
31 | 39 |
|
32 |
| - # Fetch the release from the linux-surface project |
33 |
| - rev = "arch-${version}-1"; |
34 |
| - repos = pkgs.callPackage ({ fetchFromGitHub, rev, packageHash }: { |
| 40 | + # Fetch the linux-surface package |
| 41 | + repos = pkgs.callPackage ({ fetchFromGitHub, rev, hash }: { |
35 | 42 | linux-surface = fetchFromGitHub {
|
36 | 43 | owner = "linux-surface";
|
37 | 44 | repo = "linux-surface";
|
38 | 45 | rev = rev;
|
39 |
| - hash = packageHash; |
| 46 | + hash = hash; |
40 | 47 | };
|
41 |
| - }) { inherit rev packageHash; }; |
| 48 | + }) { hash = pkgHash; rev = "arch-${pkgVersion}-1"; }; |
42 | 49 |
|
43 |
| - # Build the kernel package |
| 50 | + # Fetch and build the kernel package |
44 | 51 | inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; }) linuxPackage surfacePatches;
|
45 | 52 | kernelPatches = surfacePatches {
|
46 |
| - inherit version; |
47 |
| - patchFn = ./kernel/${shortVersion}/patches.nix; |
| 53 | + version = pkgVersion; |
| 54 | + patchFn = ./kernel/${versions.majorMinor pkgVersion}/patches.nix; |
48 | 55 | };
|
49 | 56 | kernelPackages = linuxPackage {
|
50 |
| - inherit version kernelPatches; |
| 57 | + inherit kernelPatches; version = srcVersion; |
51 | 58 | sha256 = srcHash;
|
52 | 59 | ignoreConfigErrors=true;
|
53 | 60 | };
|
|
0 commit comments