mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-11-30 19:26:21 +03:00
bin/kernel-normalize-config: Rely on a "support" system
This commit is contained in:
parent
4e473c7c43
commit
5729cba165
@ -66,7 +66,7 @@ args =
|
|||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
args << File.join(ROOT, "default.nix")
|
args << File.join(ROOT, "support/kernel-config/default.nix")
|
||||||
|
|
||||||
@file =
|
@file =
|
||||||
if params["file"]
|
if params["file"]
|
||||||
|
18
support/kernel-config/README.adoc
Normal file
18
support/kernel-config/README.adoc
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
= Kernel configuration
|
||||||
|
|
||||||
|
This directory holds the *suggested* kernel configuration.
|
||||||
|
|
||||||
|
This is used by the `bin/kernel-normalize*` helpers.
|
||||||
|
|
||||||
|
In your systems, feel free to override any of those with what you prefer.
|
||||||
|
|
||||||
|
The **required** options are found in `modules/kernel-config.nix`.
|
||||||
|
|
||||||
|
== Goals
|
||||||
|
|
||||||
|
The goals for these options are as follow:
|
||||||
|
|
||||||
|
* Remove all unneeded options to reduce compilation time
|
||||||
|
* Select the appropriate defaults
|
||||||
|
|
||||||
|
A device can change the options as needed.
|
11
support/kernel-config/configuration.nix
Normal file
11
support/kernel-config/configuration.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkDefault
|
||||||
|
;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
mobile.kernel.structuredConfig = [
|
||||||
|
];
|
||||||
|
}
|
41
support/kernel-config/default.nix
Normal file
41
support/kernel-config/default.nix
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{ pkgs ? (import ../../pkgs.nix {})
|
||||||
|
, device
|
||||||
|
}@args':
|
||||||
|
|
||||||
|
let
|
||||||
|
eval = import ../../lib/eval-with-configuration.nix ({
|
||||||
|
inherit device pkgs;
|
||||||
|
configuration = [
|
||||||
|
(
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
filter
|
||||||
|
concatStringsSep
|
||||||
|
showWarnings
|
||||||
|
;
|
||||||
|
# Handle assertions and warnings
|
||||||
|
failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
|
||||||
|
|
||||||
|
# This `eval` wraps assertion checks
|
||||||
|
_out = if failedAssertions != []
|
||||||
|
then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
|
||||||
|
else showWarnings config.warnings { inherit config; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./configuration.nix
|
||||||
|
];
|
||||||
|
options = {
|
||||||
|
_out = lib.mkOption {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = {
|
||||||
|
inherit _out;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
});
|
||||||
|
in
|
||||||
|
eval.config._out
|
Loading…
Reference in New Issue
Block a user