about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/grub/2.0x.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/grub/2.0x.nix')
-rw-r--r--nixpkgs/pkgs/tools/misc/grub/2.0x.nix34
1 files changed, 29 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/tools/misc/grub/2.0x.nix b/nixpkgs/pkgs/tools/misc/grub/2.0x.nix
index bc933312afc5..ad7a74e8137f 100644
--- a/nixpkgs/pkgs/tools/misc/grub/2.0x.nix
+++ b/nixpkgs/pkgs/tools/misc/grub/2.0x.nix
@@ -1,10 +1,14 @@
 { lib, stdenv, fetchgit, flex, bison, python3, autoconf, automake, gnulib, libtool
 , gettext, ncurses, libusb-compat-0_1, freetype, qemu, lvm2, unifont, pkg-config
+, pkgsBuildBuild
+, nixosTests
 , fuse # only needed for grub-mount
+, runtimeShell
 , zfs ? null
 , efiSupport ? false
 , zfsSupport ? false
 , xenSupport ? false
+, kbdcompSupport ? false, ckbcomp
 }:
 
 with lib;
@@ -31,7 +35,7 @@ let
   canEfi = any (system: stdenv.hostPlatform.system == system) (mapAttrsToList (name: _: name) efiSystemsBuild);
   inPCSystems = any (system: stdenv.hostPlatform.system == system) (mapAttrsToList (name: _: name) pcSystems);
 
-  version = "2.04";
+  version = "2.06-rc1";
 
 in (
 
@@ -46,18 +50,27 @@ stdenv.mkDerivation rec {
   src = fetchgit {
     url = "git://git.savannah.gnu.org/grub.git";
     rev = "${pname}-${version}";
-    sha256 = "02gly3xw88pj4zzqjniv1fxa1ilknbq1mdk30bj6qy8n44g90i8w";
+    sha256 = "1ngc960g4w91rg13l724v6nlj6fq1adxp6is2mrq4bnp7sm9mysa";
   };
 
   patches = [
     ./fix-bash-completion.patch
   ];
 
-  nativeBuildInputs = [ bison flex python3 pkg-config autoconf automake ];
-  buildInputs = [ ncurses libusb-compat-0_1 freetype gettext lvm2 fuse libtool ]
+  postPatch = if kbdcompSupport then ''
+    sed -i util/grub-kbdcomp.in -e 's@\bckbcomp\b@${ckbcomp}/bin/ckbcomp@'
+  '' else ''
+    echo '#! ${runtimeShell}' > util/grub-kbdcomp.in
+    echo 'echo "Compile grub2 with { kbdcompSupport = true; } to enable support for this command."' >> util/grub-kbdcomp.in
+  '';
+
+  nativeBuildInputs = [ bison flex python3 pkg-config autoconf automake gettext ];
+  buildInputs = [ ncurses libusb-compat-0_1 freetype lvm2 fuse libtool ]
     ++ optional doCheck qemu
     ++ optional zfsSupport zfs;
 
+  strictDeps = true;
+
   hardeningDisable = [ "all" ];
 
   # Work around a bug in the generated flex lexer (upstream flex bug?)
@@ -90,7 +103,10 @@ stdenv.mkDerivation rec {
       substituteInPlace ./configure --replace '/usr/share/fonts/unifont' '${unifont}/share/fonts'
     '';
 
-  configureFlags = [ "--enable-grub-mount" ] # dep of os-prober
+  configureFlags = [
+    "--enable-grub-mount" # dep of os-prober
+    "BUILD_CC=${pkgsBuildBuild.stdenv.cc}/bin/cc"
+  ]
     ++ optional zfsSupport "--enable-libzfs"
     ++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystemsBuild.${stdenv.hostPlatform.system}.target}" "--program-prefix=" ]
     ++ optionals xenSupport [ "--with-platform=xen" "--target=${efiSystemsBuild.${stdenv.hostPlatform.system}.target}"];
@@ -110,6 +126,14 @@ stdenv.mkDerivation rec {
     sed -i $out/lib/grub/*/modinfo.sh -e "/grub_target_cppflags=/ s|'.*'|' '|"
   '';
 
+  passthru.tests = {
+    nixos-grub = nixosTests.grub;
+    nixos-install-simple = nixosTests.installer.simple;
+    nixos-install-grub1 = nixosTests.installer.grub1;
+    nixos-install-grub-uefi = nixosTests.installer.simpleUefiGrub;
+    nixos-install-grub-uefi-spec = nixosTests.installer.simpleUefiGrubSpecialisation;
+  };
+
   meta = with lib; {
     description = "GNU GRUB, the Grand Unified Boot Loader (2.x beta)";