From a89745edd5f657e2e5be5ed1bea86725ca78d92e Mon Sep 17 00:00:00 2001 From: Astrid Yu Date: Sat, 2 Dec 2023 17:50:43 -0800 Subject: [PATCH] surface: Allow specifying major versions for kernel --- .../surface/common/kernel/linux-6.1.x/default.nix | 11 ++++++----- .../surface/common/kernel/linux-6.5.x/default.nix | 9 +++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/microsoft/surface/common/kernel/linux-6.1.x/default.nix b/microsoft/surface/common/kernel/linux-6.1.x/default.nix index 05ec4cf..dbb61d7 100644 --- a/microsoft/surface/common/kernel/linux-6.1.x/default.nix +++ b/microsoft/surface/common/kernel/linux-6.1.x/default.nix @@ -9,15 +9,16 @@ let cfg = config.microsoft-surface; version = "6.1.62"; - extraMeta.branch = "6.1"; - patchDir = repos.linux-surface + "/patches/${extraMeta.branch}"; + majorVersion = "6.1"; + patchDir = repos.linux-surface + "/patches/${majorVersion}"; kernelPatches = pkgs.callPackage ./patches.nix { inherit (lib) kernel; inherit version patchDir; }; kernelPackages = linuxPackage { - inherit version extraMeta kernelPatches; + inherit version kernelPatches; + extraMeta.branch = majorVersion; src = fetchurl { url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz"; sha256 = "sha256-uf1hb6zWvs/O74i5vnGNDxZiXKs/6B0ROEgCpwkehew="; @@ -27,10 +28,10 @@ let in { options.microsoft-surface.kernelVersion = mkOption { - type = types.enum [ version ]; + type = types.enum [ version majorVersion ]; }; - config = mkIf (cfg.kernelVersion == version ) { + config = mkIf (cfg.kernelVersion == version || cfg.kernelVersion == majorVersion) { boot = { inherit kernelPackages; }; diff --git a/microsoft/surface/common/kernel/linux-6.5.x/default.nix b/microsoft/surface/common/kernel/linux-6.5.x/default.nix index b26b466..ba3c2a0 100644 --- a/microsoft/surface/common/kernel/linux-6.5.x/default.nix +++ b/microsoft/surface/common/kernel/linux-6.5.x/default.nix @@ -9,15 +9,16 @@ let cfg = config.microsoft-surface; version = "6.5.11"; - extraMeta.branch = "6.5"; - patchDir = repos.linux-surface + "/patches/${extraMeta.branch}"; + majorVersion = "6.5"; + patchDir = repos.linux-surface + "/patches/${majorVersion}"; kernelPatches = pkgs.callPackage ./patches.nix { inherit (lib) kernel; inherit version patchDir; }; kernelPackages = linuxPackage { - inherit version extraMeta kernelPatches; + inherit version kernelPatches; + extraMeta.branch = majorVersion; src = fetchurl { url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz"; sha256 = "sha256-LuJK+SgrgJI7LaVrcKrX3y6O5OPwdkUuBbpmviBZtRk="; @@ -30,7 +31,7 @@ in { type = types.enum [ version ]; }; - config = mkIf (cfg.kernelVersion == version) { + config = mkIf (cfg.kernelVersion == version || cfg.kernelVersion == majorVersion) { boot = { inherit kernelPackages; };