1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 21:11:34 +03:00
mobile-nixos/systems/kernel-initrd.nix

38 lines
742 B
Nix
Raw Normal View History

{
device_config,
hardware_config,
initrd
}:
let
pkgs = (import ../overlay);
in
with pkgs;
let
inherit (hardware_config) ram;
device_name = device_config.name;
device_info = device_config.info;
linux = device_info.kernel;
kernel = "${linux}/*Image*";
# TODO : Allow appending / prepending
cmdline = device_info.kernel_cmdline;
in
stdenv.mkDerivation {
name = "nixos-mobile_${device_name}_boot.img";
src = builtins.filterSource (path: type: false) ./.;
unpackPhase = "true";
buildInputs = [
linux
];
installPhase = ''
mkdir -p $out/
cp ${kernel} $out/kernel
cp ${initrd} $out/initrd
echo -n "${cmdline}" > $out/cmdline.txt
echo -n "${toString ram}" > $out/ram.txt
'';
}