1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-13 04:04:35 +03:00

modules: Add shared-rootfs

Used to undo some of the close-knit integration work NixOS does, so we
can cheat an make a more generic rootfs.
This commit is contained in:
Samuel Dionne-Riel 2020-12-14 23:52:01 -05:00
parent d53c6e9868
commit 0999683e23
2 changed files with 36 additions and 0 deletions

View File

@ -35,6 +35,7 @@
./nixpkgs.nix
./quirks
./rootfs.nix
./shared-rootfs.nix
./system-target.nix
./system-types.nix
]

35
modules/shared-rootfs.nix Normal file
View File

@ -0,0 +1,35 @@
{ config, lib, ... }:
let
inherit (config.mobile.rootfs.shared) enabled;
inherit (lib) mkIf mkOption types;
in
{
options = {
mobile.rootfs.shared.enabled = mkOption {
internal = true;
type = types.bool;
default = false;
description = ''
Enable when building a generic rootfs that does not include a kernel image.
This makes sturdier rootfs that work on different devices.
'';
};
};
config = mkIf enabled {
# Ensure we don't bring a kernel or initrd into the system.
system.boot.loader.kernelFile = "dummy";
system.boot.loader.initrdFile = "dummy";
# And totally obliterate device-specific files from stage-2.
system.extraSystemBuilderCmds = ''
echo ":: Removing non-generic system items..."
(
cd $out
rm -vf dtbs initrd kernel kernel-modules kernel-params
)
'';
};
}