From 3b16a080f70f100b22b1c731f0b06079ef0ee0d1 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sat, 11 Jan 2020 19:36:23 -0500 Subject: [PATCH] initrd: Make bootConfig a tangible internal option --- modules/initrd.nix | 54 ++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/modules/initrd.nix b/modules/initrd.nix index 9cfbe5a6..226afe68 100644 --- a/modules/initrd.nix +++ b/modules/initrd.nix @@ -78,27 +78,7 @@ let exec ${optionalString withStrace "${extraUtils}/bin/strace -f"} ${initWrapperRealInit} ''; - bootConfig = { - device = { - inherit (device_config) name; - }; - kernel = { - inherit (config.mobile.boot.stage-1.kernel) modules; - }; - - # Literally transmit some nixos configurations. - nixos = { - boot.specialFileSystems = config.boot.specialFileSystems; - }; - - inherit bootFileSystems; - - boot = { - inherit (config.mobile.boot.stage-1) fail; - }; - }; - - bootConfigFile = writeText "${device_name}-boot-config" (toJSON bootConfig); + bootConfigFile = writeText "${device_name}-boot-config" (toJSON config.mobile.boot.stage-1.bootConfig); contents = (optionals (stage-1 ? contents) (flatten stage-1.contents)) @@ -222,14 +202,42 @@ in The build system for boot/init will `find -iname '*.rb'` the given paths. "; }; + mobile.boot.stage-1.bootConfig = mkOption { + type = types.attrs; + default = {}; + internal = true; + description = '' + The things being put in the JSON configuration file in stage-1. + ''; + }; }; config = { system.build.initrd = "${initrd}/initrd"; - # HACK: as we're using isContainer to bypass some NixOS stuff - # See boot.specialFileSystems = { + # HACK: as we're using isContainer to bypass some NixOS stuff + # See "/sys" = { fsType = "sysfs"; options = [ "nosuid" "noexec" "nodev" ]; }; }; + + mobile.boot.stage-1.bootConfig = { + device = { + inherit (device_config) name; + }; + kernel = { + inherit (config.mobile.boot.stage-1.kernel) modules; + }; + + # Literally transmit some nixos configurations. + nixos = { + boot.specialFileSystems = config.boot.specialFileSystems; + }; + + inherit bootFileSystems; + + boot = { + inherit (config.mobile.boot.stage-1) fail; + }; + }; }; }