2018-07-21 02:44:44 +02:00
|
|
|
{ stdenv, fetchurl, gnu-efi }:
|
2015-01-13 13:56:05 +01:00
|
|
|
|
2016-08-28 19:07:43 +02:00
|
|
|
let
|
|
|
|
archids = {
|
2019-08-13 23:52:01 +02:00
|
|
|
x86_64-linux = { hostarch = "x86_64"; efiPlatform = "x64"; };
|
|
|
|
i686-linux = rec { hostarch = "ia32"; efiPlatform = hostarch; };
|
2019-08-13 23:52:01 +02:00
|
|
|
aarch64-linux = { hostarch = "aarch64"; efiPlatform = "aa64"; };
|
2016-08-28 19:07:43 +02:00
|
|
|
};
|
2015-01-13 13:56:05 +01:00
|
|
|
|
2016-08-28 19:07:43 +02:00
|
|
|
inherit
|
2018-08-20 21:11:29 +02:00
|
|
|
(archids.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"))
|
2016-08-28 19:07:43 +02:00
|
|
|
hostarch efiPlatform;
|
|
|
|
in
|
2015-01-13 13:56:05 +01:00
|
|
|
|
2016-08-28 19:07:43 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "refind";
|
2020-03-14 01:47:14 +01:00
|
|
|
version = "0.12.0";
|
2016-08-28 19:07:43 +02:00
|
|
|
srcName = "refind-src-${version}";
|
2015-01-13 13:56:05 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-08-28 19:07:43 +02:00
|
|
|
url = "mirror://sourceforge/project/refind/${version}/${srcName}.tar.gz";
|
2020-03-14 01:47:14 +01:00
|
|
|
sha256 = "1i5p3sir3mx4i2q5w78360xn2kbgsj8rmgrqvsvag1zzr5dm1f3v";
|
2015-01-13 13:56:05 +01:00
|
|
|
};
|
|
|
|
|
2019-05-19 23:38:50 +02:00
|
|
|
patches = [
|
|
|
|
./0001-toolchain.patch
|
|
|
|
];
|
|
|
|
|
2016-08-28 19:07:43 +02:00
|
|
|
buildInputs = [ gnu-efi ];
|
2015-01-13 13:56:05 +01:00
|
|
|
|
2016-02-26 18:38:15 +01:00
|
|
|
hardeningDisable = [ "stackprotector" ];
|
2016-03-01 23:21:08 +01:00
|
|
|
|
2016-08-28 19:07:43 +02:00
|
|
|
makeFlags =
|
|
|
|
[ "prefix="
|
|
|
|
"EFIINC=${gnu-efi}/include/efi"
|
|
|
|
"EFILIB=${gnu-efi}/lib"
|
|
|
|
"GNUEFILIB=${gnu-efi}/lib"
|
|
|
|
"EFICRT0=${gnu-efi}/lib"
|
|
|
|
"HOSTARCH=${hostarch}"
|
2019-05-19 23:38:50 +02:00
|
|
|
"ARCH=${hostarch}"
|
2016-08-28 19:07:43 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [ "gnuefi" "fs_gnuefi" ];
|
2015-01-13 13:56:05 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -d $out/bin/
|
2016-08-28 19:07:43 +02:00
|
|
|
install -d $out/share/refind/drivers_${efiPlatform}/
|
|
|
|
install -d $out/share/refind/tools_${efiPlatform}/
|
2015-01-13 13:56:05 +01:00
|
|
|
install -d $out/share/refind/docs/html/
|
|
|
|
install -d $out/share/refind/docs/Styles/
|
|
|
|
install -d $out/share/refind/fonts/
|
|
|
|
install -d $out/share/refind/icons/
|
|
|
|
install -d $out/share/refind/images/
|
|
|
|
install -d $out/share/refind/keys/
|
|
|
|
|
|
|
|
# refind uefi app
|
2016-08-28 19:07:43 +02:00
|
|
|
install -D -m0644 refind/refind_${efiPlatform}.efi $out/share/refind/refind_${efiPlatform}.efi
|
2015-01-13 13:56:05 +01:00
|
|
|
|
|
|
|
# uefi drivers
|
2016-08-28 19:07:43 +02:00
|
|
|
install -D -m0644 drivers_${efiPlatform}/*.efi $out/share/refind/drivers_${efiPlatform}/
|
2015-01-13 13:56:05 +01:00
|
|
|
|
|
|
|
# uefi apps
|
2016-08-28 19:07:43 +02:00
|
|
|
install -D -m0644 gptsync/gptsync_${efiPlatform}.efi $out/share/refind/tools_${efiPlatform}/gptsync_${efiPlatform}.efi
|
2015-01-13 13:56:05 +01:00
|
|
|
|
|
|
|
# helper scripts
|
2018-05-03 21:54:09 +02:00
|
|
|
install -D -m0755 refind-install $out/bin/refind-install
|
2016-08-27 10:37:53 +02:00
|
|
|
install -D -m0755 mkrlconf $out/bin/refind-mkrlconf
|
|
|
|
install -D -m0755 mvrefind $out/bin/refind-mvrefind
|
2015-01-13 13:56:05 +01:00
|
|
|
install -D -m0755 fonts/mkfont.sh $out/bin/refind-mkfont
|
|
|
|
|
|
|
|
# sample config files
|
|
|
|
install -D -m0644 refind.conf-sample $out/share/refind/refind.conf-sample
|
|
|
|
|
|
|
|
# docs
|
|
|
|
install -D -m0644 docs/refind/* $out/share/refind/docs/html/
|
|
|
|
install -D -m0644 docs/Styles/* $out/share/refind/docs/Styles/
|
|
|
|
install -D -m0644 README.txt $out/share/refind/docs/README.txt
|
|
|
|
install -D -m0644 NEWS.txt $out/share/refind/docs/NEWS.txt
|
|
|
|
install -D -m0644 BUILDING.txt $out/share/refind/docs/BUILDING.txt
|
|
|
|
install -D -m0644 CREDITS.txt $out/share/refind/docs/CREDITS.txt
|
|
|
|
|
|
|
|
# fonts
|
|
|
|
install -D -m0644 fonts/* $out/share/refind/fonts/
|
|
|
|
rm -f $out/share/refind/fonts/mkfont.sh
|
|
|
|
|
|
|
|
# icons
|
2016-08-27 10:37:53 +02:00
|
|
|
install -D -m0644 icons/*.png $out/share/refind/icons/
|
2015-01-13 13:56:05 +01:00
|
|
|
|
|
|
|
# images
|
|
|
|
install -D -m0644 images/*.{png,bmp} $out/share/refind/images/
|
|
|
|
|
|
|
|
# keys
|
|
|
|
install -D -m0644 keys/* $out/share/refind/keys/
|
|
|
|
|
2018-05-03 21:54:09 +02:00
|
|
|
# Fix variable definition of 'RefindDir' which is used to locate ressource files.
|
|
|
|
sed -i "s,\bRefindDir=.*,RefindDir=$out/share/refind,g" $out/bin/refind-install
|
2016-08-28 19:07:43 +02:00
|
|
|
|
|
|
|
# Patch uses of `which`. We could patch in calls to efibootmgr,
|
|
|
|
# openssl, convert, and openssl, but that would greatly enlarge
|
|
|
|
# refind's closure (from ca 28MB to over 400MB).
|
2018-05-03 21:54:09 +02:00
|
|
|
sed -i 's,`which \(.*\)`,`type -p \1`,g' $out/bin/refind-install
|
2016-08-28 19:07:43 +02:00
|
|
|
sed -i 's,`which \(.*\)`,`type -p \1`,g' $out/bin/refind-mvrefind
|
|
|
|
sed -i 's,`which \(.*\)`,`type -p \1`,g' $out/bin/refind-mkfont
|
2015-01-13 13:56:05 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A graphical {,U}EFI boot manager";
|
|
|
|
longDescription = ''
|
|
|
|
rEFInd is a graphical boot manager for EFI- and UEFI-based
|
|
|
|
computers, such as all Intel-based Macs and recent (most 2011
|
|
|
|
and later) PCs. rEFInd presents a boot menu showing all the EFI
|
|
|
|
boot loaders on the EFI-accessible partitions, and optionally
|
|
|
|
BIOS-bootable partitions on Macs. EFI-compatbile OSes, including
|
|
|
|
Linux, provide boot loaders that rEFInd can detect and
|
|
|
|
launch. rEFInd can launch Linux EFI boot loaders such as ELILO,
|
|
|
|
GRUB Legacy, GRUB 2, and 3.3.0 and later kernels with EFI stub
|
|
|
|
support. EFI filesystem drivers for ext2/3/4fs, ReiserFS, HFS+,
|
|
|
|
and ISO-9660 enable rEFInd to read boot loaders from these
|
|
|
|
filesystems, too. rEFInd's ability to detect boot loaders at
|
|
|
|
runtime makes it very easy to use, particularly when paired with
|
|
|
|
Linux kernels that provide EFI stub support.
|
|
|
|
'';
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://refind.sourceforge.net/";
|
2020-02-13 22:04:48 +01:00
|
|
|
maintainers = with maintainers; [ AndersonTorres samueldr ];
|
2019-05-19 23:38:50 +02:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ];
|
2018-08-06 12:21:56 +02:00
|
|
|
license = licenses.gpl3Plus;
|
2015-01-13 13:56:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|