surface: fix kernel

This commit is contained in:
2024-01-17 15:06:55 +08:00
parent 48f450bfe3
commit 00d010a910

View File

@@ -57,23 +57,20 @@ inputs:
};
bugs = [ "xmunet" ];
};
# apply patches from nixos-hardware
boot.kernelPatches = builtins.map
(patch:
{ inherit (patch) name patch; }
// (if patch ? structuredExtraConfig then { extraStructuredConfig = patch.structuredExtraConfig; } else {}))
(
let
version = inputs.config.boot.kernelPackages.kernel.version;
majorVersion =
let versionArray = builtins.splitVersion version;
in "${builtins.elemAt versionArray 0}.${builtins.elemAt versionArray 1}";
repoFile = "${inputs.topInputs.nixos-hardware}/microsoft/surface/common/kernel/linux-package.nix";
inherit (inputs.pkgs.callPackage repoFile {}) repos;
patchDir = repos.linux-surface + "/patches/${majorVersion}";
patchFile = "${inputs.topInputs.nixos-hardware}/microsoft/surface/common/kernel/linux-6.6.x/patches.nix";
in
inputs.pkgs.callPackage patchFile { inherit (inputs.lib) kernel; inherit version patchDir; }
);
boot.kernelPackages =
let
originalKernel = inputs.pkgs.linuxPackages_xanmod_latest.kernel;
version = originalKernel.version;
majorVersion =
let versionArray = builtins.splitVersion version;
in "${builtins.elemAt versionArray 0}.${builtins.elemAt versionArray 1}";
repoFile = "${inputs.topInputs.nixos-hardware}/microsoft/surface/common/kernel/linux-package.nix";
inherit (inputs.pkgs.callPackage repoFile {}) repos;
patchDir = repos.linux-surface + "/patches/${majorVersion}";
patchFile = "${inputs.topInputs.nixos-hardware}/microsoft/surface/common/kernel/linux-6.6.x/patches.nix";
kernelPatches = inputs.pkgs.callPackage patchFile { inherit (inputs.lib) kernel; inherit version patchDir; };
in
inputs.lib.mkForce (inputs.pkgs.linuxPackagesFor (originalKernel.override
(prev: { kernelPatches = prev.kernelPatches ++ kernelPatches; })));
};
}