surface: Allow specifying major versions for kernel

This commit is contained in:
Astrid Yu 2023-12-02 17:50:43 -08:00 committed by mergify[bot]
parent eb4e574360
commit a89745edd5
2 changed files with 11 additions and 9 deletions

View file

@ -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;
};

View file

@ -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;
};