1
1
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:
Samuel Dionne-Riel 2023-09-11 18:27:21 -04:00
parent 4e473c7c43
commit 5729cba165
4 changed files with 71 additions and 1 deletions

View File

@ -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"]

View 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.

View File

@ -0,0 +1,11 @@
{ lib, ... }:
let
inherit (lib)
mkDefault
;
in
{
mobile.kernel.structuredConfig = [
];
}

View 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