1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-27 01:44:41 +03:00
mobile-nixos/systems/kernel-initrd.nix
2018-06-26 21:52:22 -04:00

36 lines
716 B
Nix

{
device_config
, hardware_config
, initrd
, pkgs
}:
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
'';
}