From e1806b4c1bd647c181993ab332c8e47b47b66cce Mon Sep 17 00:00:00 2001 From: Yegor Timoshenko Date: Sun, 24 Dec 2017 16:11:44 +0300 Subject: [PATCH] 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. --- lib/hardware-notes.nix | 45 ------------------------------------------ lib/kernel-version.nix | 31 ----------------------------- 2 files changed, 76 deletions(-) delete mode 100644 lib/hardware-notes.nix delete mode 100644 lib/kernel-version.nix diff --git a/lib/hardware-notes.nix b/lib/hardware-notes.nix deleted file mode 100644 index 4414ea3..0000000 --- a/lib/hardware-notes.nix +++ /dev/null @@ -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; - }; - -} diff --git a/lib/kernel-version.nix b/lib/kernel-version.nix deleted file mode 100644 index 99115a7..0000000 --- a/lib/kernel-version.nix +++ /dev/null @@ -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 - ); - -}