Use a new linuxPackage function

This commit is contained in:
mexisme committed 2023-11-26 12:42:11 +13:00
1 parent c3abafb01c
commit 8605f354e2
5 files changed
+84 -47

No files matched your search

@@ -1,16 +1,17 @@
{ lib,
{ pkgs,
lib,
fetchurl,
buildLinux,
callPackage,
linuxPackagesFor,
}:
let
inherit (lib) recurseIntoAttrs;
inherit (lib) recurseIntoAttrs versions;
repos = pkgs.callPackage ../repos.nix {};
in {
repos = callPackage ../repos.nix {};
linuxPackage =
# Version 1 of the linuxPackage function:
# (DEPRECATED)
linuxPackage1 =
{ version,
modDirVersion ? version,
...
@@ -19,4 +20,38 @@ in {
buildLinux' = buildLinux (args // { inherit modDirVersion; });
linuxPackagesFor' = linuxPackagesFor buildLinux';
in recurseIntoAttrs linuxPackagesFor';
# Version 1 of the linuxPackage funtion, with hopefully simplified arguments:
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 =
{ patchSrc ? (repos.linux-surface + "/patches/${versions.major version}"),
version,
patchFn,
}: pkgs.callPackage patchFn {
inherit (lib) kernel;
inherit version patchSrc;
};
in {
inherit linuxPackage1 linuxPackage2 repos surfacePatches;
# Default version:
linuxPackage = linuxPackage2;
}