1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-12-27 12:09:45 +01:00

Use a new linuxPackage function

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

View file

@ -4,19 +4,19 @@ let
inherit (lib) mkIf mkOption types;
inherit (pkgs) fetchurl;
inherit (pkgs.callPackage ../linux-package.nix { }) linuxPackage repos;
inherit (pkgs.callPackage ../linux-package.nix { }) linuxPackage1 repos;
cfg = config.microsoft-surface;
version = "6.1.62";
extraMeta.branch = "6.1";
patchDir = repos.linux-surface + "/patches/${extraMeta.branch}";
patchSrc = repos.linux-surface + "/patches/${extraMeta.branch}";
kernelPatches = pkgs.callPackage ./patches.nix {
inherit (lib) kernel;
inherit version patchDir;
inherit version patchSrc;
};
kernelPackages = linuxPackage {
kernelPackages = linuxPackage1 {
inherit version extraMeta kernelPatches;
src = fetchurl {
url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz";

View file

@ -1,5 +1,6 @@
{ kernel,
patchDir,
{ lib,
kernel ? lib.kernel,
patchSrc,
version,
}:
@ -84,58 +85,58 @@
}
{
name = "ms-surface/0001-surface3-oemb";
patch = patchDir + "/0001-surface3-oemb.patch";
patch = patchSrc + "/0001-surface3-oemb.patch";
}
{
name = "ms-surface/0002-mwifiex";
patch = patchDir + "/0002-mwifiex.patch";
patch = patchSrc + "/0002-mwifiex.patch";
}
{
name = "ms-surface/0003-ath10k";
patch = patchDir + "/0003-ath10k.patch";
patch = patchSrc + "/0003-ath10k.patch";
}
{
name = "ms-surface/0004-ipts";
patch = patchDir + "/0004-ipts.patch";
patch = patchSrc + "/0004-ipts.patch";
}
{
name = "ms-surface/0005-ithc";
patch = patchDir + "/0005-ithc.patch";
patch = patchSrc + "/0005-ithc.patch";
}
{
name = "ms-surface/0006-surface-sam";
patch = patchDir + "/0006-surface-sam.patch";
patch = patchSrc + "/0006-surface-sam.patch";
}
{
name = "ms-surface/0007-surface-sam-over-hid";
patch = patchDir + "/0007-surface-sam-over-hid.patch";
patch = patchSrc + "/0007-surface-sam-over-hid.patch";
}
{
name = "ms-surface/0008-surface-button";
patch = patchDir + "/0008-surface-button.patch";
patch = patchSrc + "/0008-surface-button.patch";
}
{
name = "ms-surface/0009-surface-typecover";
patch = patchDir + "/0009-surface-typecover.patch";
patch = patchSrc + "/0009-surface-typecover.patch";
}
{
name = "ms-surface/0010-surface-shutdown";
patch = patchDir + "/0010-surface-shutdown.patch";
patch = patchSrc + "/0010-surface-shutdown.patch";
}
{
name = "ms-surface/0011-surface-gpe";
patch = patchDir + "/0011-surface-gpe.patch";
patch = patchSrc + "/0011-surface-gpe.patch";
}
{
name = "ms-surface/0012-cameras";
patch = patchDir + "/0012-cameras.patch";
patch = patchSrc + "/0012-cameras.patch";
}
{
name = "ms-surface/0013-amd-gpio";
patch = patchDir + "/0013-amd-gpio.patch";
patch = patchSrc + "/0013-amd-gpio.patch";
}
{
name = "ms-surface/0014-rtc";
patch = patchDir + "/0014-rtc.patch";
patch = patchSrc + "/0014-rtc.patch";
}
]

View file

@ -4,19 +4,19 @@ let
inherit (lib) mkIf mkOption types;
inherit (pkgs) fetchurl;
inherit (pkgs.callPackage ../linux-package.nix { }) linuxPackage repos;
inherit (pkgs.callPackage ../linux-package.nix { }) linuxPackage1 repos;
cfg = config.microsoft-surface;
version = "6.5.11";
extraMeta.branch = "6.5";
patchDir = repos.linux-surface + "/patches/${extraMeta.branch}";
patchSrc = repos.linux-surface + "/patches/${extraMeta.branch}";
kernelPatches = pkgs.callPackage ./patches.nix {
inherit (lib) kernel;
inherit version patchDir;
inherit version patchSrc;
};
kernelPackages = linuxPackage {
kernelPackages = linuxPackage1 {
inherit version extraMeta kernelPatches;
src = fetchurl {
url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz";

View file

@ -1,5 +1,6 @@
{ kernel,
patchDir,
{ lib,
kernel ? lib.kernel,
patchSrc,
version,
}:
@ -85,58 +86,58 @@
}
{
name = "ms-surface/0001-surface3-oemb";
patch = patchDir + "/0001-surface3-oemb.patch";
patch = patchSrc + "/0001-surface3-oemb.patch";
}
{
name = "ms-surface/0002-mwifiex";
patch = patchDir + "/0002-mwifiex.patch";
patch = patchSrc + "/0002-mwifiex.patch";
}
{
name = "ms-surface/0003-ath10k";
patch = patchDir + "/0003-ath10k.patch";
patch = patchSrc + "/0003-ath10k.patch";
}
{
name = "ms-surface/0004-ipts";
patch = patchDir + "/0004-ipts.patch";
patch = patchSrc + "/0004-ipts.patch";
}
{
name = "ms-surface/0005-ithc";
patch = patchDir + "/0005-ithc.patch";
patch = patchSrc + "/0005-ithc.patch";
}
{
name = "ms-surface/0006-surface-sam";
patch = patchDir + "/0006-surface-sam.patch";
patch = patchSrc + "/0006-surface-sam.patch";
}
{
name = "ms-surface/0007-surface-sam-over-hid";
patch = patchDir + "/0007-surface-sam-over-hid.patch";
patch = patchSrc + "/0007-surface-sam-over-hid.patch";
}
{
name = "ms-surface/0008-surface-button";
patch = patchDir + "/0008-surface-button.patch";
patch = patchSrc + "/0008-surface-button.patch";
}
{
name = "ms-surface/0009-surface-typecover";
patch = patchDir + "/0009-surface-typecover.patch";
patch = patchSrc + "/0009-surface-typecover.patch";
}
{
name = "ms-surface/0010-surface-shutdown";
patch = patchDir + "/0010-surface-shutdown.patch";
patch = patchSrc + "/0010-surface-shutdown.patch";
}
{
name = "ms-surface/0011-surface-gpe";
patch = patchDir + "/0011-surface-gpe.patch";
patch = patchSrc + "/0011-surface-gpe.patch";
}
{
name = "ms-surface/0012-cameras";
patch = patchDir + "/0012-cameras.patch";
patch = patchSrc + "/0012-cameras.patch";
}
{
name = "ms-surface/0013-amd-gpio";
patch = patchDir + "/0013-amd-gpio.patch";
patch = patchSrc + "/0013-amd-gpio.patch";
}
{
name = "ms-surface/0014-rtc";
patch = patchDir + "/0014-rtc.patch";
patch = patchSrc + "/0014-rtc.patch";
}
]

View file

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