{ stdenv, fetchFromGitHub, nasm }: let arch = if stdenv.isi686 then "i386" else if stdenv.isx86_64 then "x86_64" else throw "Unknown architecture"; in stdenv.mkDerivation rec { name = "grub4dos-${version}"; version = "0.4.6a-2018-02-20"; src = fetchFromGitHub { owner = "chenall"; repo = "grub4dos"; rev = "74f6c862c73a4d21e61832174f4ab2f1d7f8b12a"; sha256 = "0p85y5adnlcs4cdi9dg6f5fzzc1y12bmfhx13qs0576izx2rma3q"; }; nativeBuildInputs = [ nasm ]; hardeningDisable = [ "stackprotector" ]; configureFlags = [ "--host=${arch}-pc-linux-gnu" ]; postInstall = '' mv $out/lib/grub/${arch}-pc/* $out/lib/grub rmdir $out/lib/grub/${arch}-pc chmod +x $out/lib/grub/bootlace.com ''; dontStrip = true; dontPatchELF = true; meta = with stdenv.lib; { homepage = http://grub4dos.chenall.net/; description = "GRUB for DOS is the dos extension of GRUB"; maintainers = with maintainers; [ abbradar ]; platforms = platforms.linux; license = licenses.gpl2; }; }