lib.kernel: make public

Remove the "version" parameter in order to make it more widely
available.
Starts making some kernel configuration helpers available.
The intent is to be able to better build and check the linux kernel
configuration.
wip/yesman
Matthieu Coudron 5 years ago
parent 2436c27541
commit afa0e02d64
  1. 3
      lib/default.nix
  2. 7
      lib/kernel.nix
  3. 9
      pkgs/os-specific/linux/kernel/common-config.nix
  4. 3
      pkgs/os-specific/linux/kernel/hardened-config.nix
  5. 2
      pkgs/os-specific/linux/kernel/mptcp-config.nix

@ -52,6 +52,9 @@ let
# back-compat aliases
platforms = systems.doubles;
# linux kernel configuration
kernel = callLibs ./kernel.nix;
inherit (builtins) add addErrorContext attrNames concatLists
deepSeq elem elemAt filter genericClosure genList getAttr
hasAttr head isAttrs isBool isInt isList isString length

@ -1,12 +1,7 @@
{ lib, version }:
{ lib }:
with lib;
{
# Common patterns/legacy
whenAtLeast = ver: mkIf (versionAtLeast version ver);
whenOlder = ver: mkIf (versionOlder version ver);
# range is (inclusive, exclusive)
whenBetween = verLow: verHigh: mkIf (versionAtLeast version verLow && versionOlder version verHigh);
# Keeping these around in case we decide to change this horrible implementation :)

@ -16,10 +16,15 @@
}:
with stdenv.lib;
with import ../../../../lib/kernel.nix { inherit (stdenv) lib; inherit version; };
with stdenv.lib.kernel;
let
# Common patterns/legacy
whenAtLeast = ver: mkIf (versionAtLeast version ver);
whenOlder = ver: mkIf (versionOlder version ver);
# range is (inclusive, exclusive)
whenBetween = verLow: verHigh: mkIf (versionAtLeast version verLow && versionOlder version verHigh);
# configuration items have to be part of a subattrs
flattenKConf = nested: mapAttrs (_: head) (zipAttrs (attrValues nested));

@ -11,8 +11,7 @@
{ stdenv, version }:
with stdenv.lib;
with import ../../../../lib/kernel.nix { inherit (stdenv) lib; inherit version; };
with stdenv.lib.kernel;
assert (versionAtLeast version "4.9");
optionalAttrs (stdenv.hostPlatform.platform.kernelArch == "x86_64") {

@ -1,5 +1,5 @@
{ stdenv }:
with import ../../../../lib/kernel.nix { inherit (stdenv) lib; version = null; };
with stdenv.lib.kernel;
{
# DRM_AMDGPU = yes;

Loading…
Cancel
Save