diff --git a/bin/kernel-normalize-config b/bin/kernel-normalize-config index e6d89746..f3e7a1bb 100755 --- a/bin/kernel-normalize-config +++ b/bin/kernel-normalize-config @@ -66,7 +66,7 @@ args = end # -args << File.join(ROOT, "default.nix") +args << File.join(ROOT, "support/kernel-config/default.nix") @file = if params["file"] diff --git a/support/kernel-config/README.adoc b/support/kernel-config/README.adoc new file mode 100644 index 00000000..2d2892a8 --- /dev/null +++ b/support/kernel-config/README.adoc @@ -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. diff --git a/support/kernel-config/configuration.nix b/support/kernel-config/configuration.nix new file mode 100644 index 00000000..bfbd256b --- /dev/null +++ b/support/kernel-config/configuration.nix @@ -0,0 +1,11 @@ +{ lib, ... }: + +let + inherit (lib) + mkDefault + ; +in +{ + mobile.kernel.structuredConfig = [ + ]; +} diff --git a/support/kernel-config/default.nix b/support/kernel-config/default.nix new file mode 100644 index 00000000..88bf93c8 --- /dev/null +++ b/support/kernel-config/default.nix @@ -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