1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-30 06:49:43 +01:00

lib: drop, fixes #16 (#37)

Hardware notes are seemingly less useful than a README, and
kernelAtLeast option, while potentially useful:

a) is not used anywhere in the tree at the moment,
b) doesn't properly work when there are multiple elements in the list,
c) assumes that there are no degradations ever.
This commit is contained in:
Yegor Timoshenko 2017-12-24 16:11:44 +03:00 committed by zimbatm
parent bf86fda74c
commit e1806b4c1b
2 changed files with 0 additions and 76 deletions

View file

@ -1,45 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
# use tail recursion to prevent whitespace padding
mkLog = list:
let
head = builtins.head list;
tail = builtins.tail list;
in
''
# ${head.title}
${head.text}${if tail == [] then "" else "\n\n${mkLog tail}"}
'';
in
{
options = {
hardwareNotes = mkOption {
internal = true;
type = types.listOf types.optionSet;
options = {
title = mkOption {
type = types.str;
example = "Thunkpad-2000: increase self-destruct timeout";
};
text = mkOption {
type = types.str;
example =
''
Increase security timeout at boot using platform managment
tool to prevent premature data loss.
'';
};
};
};
};
config = {
environment.etc."hardware-notes".text = mkLog config.hardwareNotes;
};
}

View file

@ -1,31 +0,0 @@
{ 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
);
}