mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-11-04 18:19:40 +01:00
0a3514de56
Issues a warning when the kernel version is below a threshhold.
31 lines
747 B
Nix
31 lines
747 B
Nix
{ config, lib, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config;
|
|
in
|
|
{
|
|
options.kernelAtleast = mkOption {
|
|
type = types.listOf types.optionSet;
|
|
options =
|
|
[ { version = mkOption {
|
|
type = types.str;
|
|
example = "4.4";
|
|
description =
|
|
"Issue warning when kernel version is below this number.";
|
|
};
|
|
msg = mkOption {
|
|
type = types.str;
|
|
example = "";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
|
|
config.warnings = builtins.concatLists (map
|
|
(x: if (builtins.compareVersions cfg.boot.kernelPackages.kernel.version x.version) == -1
|
|
then [ "${x.msg} (${cfg.boot.kernelPackages.kernel.version} < ${x.version})" ]
|
|
else [ ]
|
|
) cfg.kernelAtleast
|
|
);
|
|
|
|
}
|