Skip to content

Commit 9726adf

Browse files
committed
microsoft/surface: add kernel source hash logic
1 parent 8141742 commit 9726adf

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

microsoft/surface/common/default.nix

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,41 @@
33
let
44
inherit (lib) mkDefault mkOption types;
55

6-
version = config.microsoft-surface.kernelVersion;
7-
rev =
8-
if version == "6.12" then
9-
"arch-6.12.19-1"
10-
else if version == "6.13" then
11-
"arch-6.13.6-1"
6+
shortVersion = config.microsoft-surface.kernelVersion;
7+
version = if shortVersion == "6.12" then
8+
"6.12.19"
9+
else if shortVersion == "6.13" then
10+
"6.13.6"
1211
else
13-
abort "Invalid kernel version: ${version}";
12+
abort "Invalid kernel version: ${shortVersion}";
13+
14+
rev = "arch-${version}-1";
1415

1516
hash =
16-
if version == "6.12" then
17+
if shortVersion == "6.12" then
1718
"sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY="
18-
else if version == "6.13" then
19+
else if shortVersion == "6.13" then
1920
"sha256-otD1ckNxNnvV8xipf9SZpbfg+bBq5EPwyieYtLIV4Ck="
2021
else
21-
abort "Invalid kernel version: ${version}";
22+
abort "Invalid kernel version: ${shortVersion}";
23+
24+
srcHash =
25+
if shortVersion == "6.12" then
26+
"sha256-1zvwV77ARDSxadG2FkGTb30Ml865I6KB8y413U3MZTE="
27+
else if shortVersion == "6.13" then
28+
"sha256-3gBTy0E9QI8g/R1XiCGZUbikQD5drBsdkDIJCTis0Zk="
29+
else
30+
abort "Invalid kernel version: ${shortVersion}";
2231

2332
inherit (pkgs.callPackage ./kernel/linux-package.nix { repos = pkgs.callPackage ./kernel/repos.nix { rev = rev; hash = hash; }; }) linuxPackage surfacePatches;
2433

2534
kernelPatches = surfacePatches {
2635
inherit version;
27-
patchFn = ./kernel/${version}/patches.nix;
36+
patchFn = ./kernel/${shortVersion}/patches.nix;
2837
};
2938
kernelPackages = linuxPackage {
3039
inherit version kernelPatches;
31-
sha256 = "sha256-1zvwV77ARDSxadG2FkGTb30Ml865I6KB8y413U3MZTE=";
40+
sha256 = srcHash;
3241
ignoreConfigErrors=true;
3342
};
3443

0 commit comments

Comments
 (0)