1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 11:03:37 +03:00
mobile-nixos/systems/kernel-initrd.nix
2020-02-29 16:10:00 -05:00

36 lines
721 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 = "mobile-nixos_${device_name}-kernel-initrd";
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
'';
}