1
0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-06-09 22:33:40 +02:00

Add some functions to allow for a major.minor kernel version to be able to auto-allow the major.minor.patch to be auto-selected

This commit is contained in:
mexisme 2024-01-31 21:31:15 +13:00
parent 606b6a270e
commit c5214dc06a

View File

@ -6,7 +6,9 @@
}: }:
let let
inherit (lib) recurseIntoAttrs versions; inherit (builtins) elem;
inherit (lib) recurseIntoAttrs types versions;
repos = pkgs.callPackage ../repos.nix {}; repos = pkgs.callPackage ../repos.nix {};
linuxPackage = linuxPackage =
@ -36,6 +38,18 @@ let
inherit version patchSrc; inherit version patchSrc;
}; };
versionsOf = version:
# Provides a list of versions that can be used as an enum option for this full version:
[ version (versions.majorMinor version) ];
versionsOfOption = version:
# Provide an enum option for versions of this kernel:
types.enum (versionsOf version);
isVersionOf = kernelVersion: version:
# Test if the provided version is considered one of the list of versions from above:
elem version (versionsOf version);
in { in {
inherit linuxPackage repos surfacePatches; inherit linuxPackage repos surfacePatches versionsOf isVersionOf versionsOfOption;
} }