nixpkgs/pkgs/tools/misc/grub/pvgrub_image/default.nix
Will Dietz 855e0463ab tree-wide: platforms = platforms.gnu; -> platforms = gnu ++ linux
"platforms.gnu" has been linux-only since at least 17.03:

$ nix eval -f channel:nixos-17.03 lib.platforms.gnu
[ "i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "mips64el-linux" ]

Unlike platforms.linux, platforms.gnu indicates "must use glibc"
which for the most part is not intended.

Replacing platforms.gnu with platforms.linux would be the same "today"
but let's err on preserving existing behavior and be optimistic
about platforms these packages work on.
2018-04-30 18:08:48 -05:00

43 lines
1.2 KiB
Nix

{ stdenv, grub2_xen }:
with stdenv.lib;
let
efiSystemsBuild = {
"i686-linux".target = "i386";
"x86_64-linux".target = "x86_64";
"aarch64-linux".target = "aarch64";
};
in (
stdenv.mkDerivation rec {
name = "pvgrub-image";
configs = ./configs;
buildInputs = [ grub2_xen ];
buildCommand = ''
cp "${configs}"/* .
tar -cf memdisk.tar grub.cfg
# We include all modules except all_video.mod as otherwise grub will fail printing "no symbol table"
# if we include it.
grub-mkimage -O "${efiSystemsBuild.${stdenv.system}.target}-xen" -c grub-bootstrap.cfg \
-m memdisk.tar -o "grub-${efiSystemsBuild.${stdenv.system}.target}-xen.bin" \
$(ls "${grub2_xen}/lib/grub/${efiSystemsBuild.${stdenv.system}.target}-xen/" |grep 'mod''$'|grep -v '^all_video\.mod''$')
mkdir -p "$out/lib/grub-xen"
cp "grub-${efiSystemsBuild.${stdenv.system}.target}-xen.bin" $out/lib/grub-xen/
'';
meta = with stdenv.lib; {
description = "PvGrub image for use for booting PV Xen guests";
longDescription =
'' This package provides a PvGrub image for booting Para-Virtualized (PV)
Xen guests
'';
platforms = platforms.gnu ++ platforms.linux;
};
})