Skip to content

Commit

Permalink
surface: Allow specifying major versions for kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
ifd3f authored and mergify[bot] committed Dec 3, 2023
1 parent eb4e574 commit a89745e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
11 changes: 6 additions & 5 deletions microsoft/surface/common/kernel/linux-6.1.x/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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=";
Expand All @@ -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;
};
Expand Down
9 changes: 5 additions & 4 deletions microsoft/surface/common/kernel/linux-6.5.x/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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=";
Expand All @@ -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;
};
Expand Down

0 comments on commit a89745e

Please sign in to comment.