2023-11-25 23:42:11 +00:00
|
|
|
{ pkgs,
|
|
|
|
lib,
|
|
|
|
fetchurl,
|
2022-12-05 04:32:25 +00:00
|
|
|
buildLinux,
|
|
|
|
linuxPackagesFor,
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2023-11-25 23:42:11 +00:00
|
|
|
inherit (lib) recurseIntoAttrs versions;
|
|
|
|
repos = pkgs.callPackage ../repos.nix {};
|
2022-12-05 04:32:25 +00:00
|
|
|
|
2023-11-25 23:42:11 +00:00
|
|
|
# Version 1 of the linuxPackage function:
|
|
|
|
# (DEPRECATED)
|
|
|
|
linuxPackage1 =
|
2022-12-05 04:32:25 +00:00
|
|
|
{ version,
|
|
|
|
modDirVersion ? version,
|
|
|
|
...
|
|
|
|
} @ args:
|
|
|
|
let
|
|
|
|
buildLinux' = buildLinux (args // { inherit modDirVersion; });
|
|
|
|
linuxPackagesFor' = linuxPackagesFor buildLinux';
|
|
|
|
in recurseIntoAttrs linuxPackagesFor';
|
2023-11-25 23:42:11 +00:00
|
|
|
|
2023-11-26 00:01:52 +00:00
|
|
|
# Version 1 of the linuxPackage function, with hopefully simplified arguments:
|
2023-11-25 23:42:11 +00:00
|
|
|
linuxPackage2 =
|
|
|
|
{ url ? "mirror://kernel/linux/kernel/v${versions.major version}.x/linux-${version}.tar.xz",
|
|
|
|
sha256 ? null,
|
|
|
|
src ? (fetchurl { inherit url sha256; }),
|
|
|
|
version,
|
|
|
|
modDirVersion ? (versions.pad 3 version),
|
|
|
|
kernelPatches ? [],
|
|
|
|
...
|
|
|
|
} @ args: let
|
|
|
|
inherit (builtins) removeAttrs;
|
|
|
|
|
|
|
|
args' = {
|
|
|
|
inherit src version modDirVersion kernelPatches;
|
|
|
|
} // removeAttrs args [ "url" "sha256" ];
|
|
|
|
linuxPackage = buildLinux args';
|
|
|
|
linuxPackages' = recurseIntoAttrs (linuxPackagesFor linuxPackage);
|
|
|
|
in linuxPackages';
|
|
|
|
|
|
|
|
surfacePatches =
|
2023-11-26 00:01:52 +00:00
|
|
|
{ patchSrc ? (repos.linux-surface + "/patches/${versions.majorMinor version}"),
|
2023-11-25 23:42:11 +00:00
|
|
|
version,
|
|
|
|
patchFn,
|
|
|
|
}: pkgs.callPackage patchFn {
|
|
|
|
inherit (lib) kernel;
|
|
|
|
inherit version patchSrc;
|
|
|
|
};
|
|
|
|
|
|
|
|
in {
|
|
|
|
inherit linuxPackage1 linuxPackage2 repos surfacePatches;
|
|
|
|
|
|
|
|
# Default version:
|
|
|
|
linuxPackage = linuxPackage2;
|
2022-12-05 04:32:25 +00:00
|
|
|
}
|