at 18.03-beta 130 lines 4.8 kB view raw
1{ stdenv, fetchurl, fetchpatch, gnu-efi }: 2 3let 4 archids = { 5 "x86_64-linux" = { hostarch = "x86_64"; efiPlatform = "x64"; }; 6 "i686-linux" = rec { hostarch = "ia32"; efiPlatform = hostarch; }; 7 }; 8 9 inherit 10 (archids.${stdenv.system} or (throw "unsupported system: ${stdenv.system}")) 11 hostarch efiPlatform; 12in 13 14stdenv.mkDerivation rec { 15 name = "refind-${version}"; 16 version = "0.11.2"; 17 srcName = "refind-src-${version}"; 18 19 src = fetchurl { 20 url = "mirror://sourceforge/project/refind/${version}/${srcName}.tar.gz"; 21 sha256 = "1k0xpm4y0gk1rxqdyprqyqpg5j16xw3l2gm3d9zpi5n9id43jkzn"; 22 }; 23 24 buildInputs = [ gnu-efi ]; 25 26 hardeningDisable = [ "stackprotector" ]; 27 28 makeFlags = 29 [ "prefix=" 30 "EFIINC=${gnu-efi}/include/efi" 31 "EFILIB=${gnu-efi}/lib" 32 "GNUEFILIB=${gnu-efi}/lib" 33 "EFICRT0=${gnu-efi}/lib" 34 "HOSTARCH=${hostarch}" 35 ]; 36 37 buildFlags = [ "gnuefi" "fs_gnuefi" ]; 38 39 installPhase = '' 40 install -d $out/bin/ 41 install -d $out/share/refind/drivers_${efiPlatform}/ 42 install -d $out/share/refind/tools_${efiPlatform}/ 43 install -d $out/share/refind/docs/html/ 44 install -d $out/share/refind/docs/Styles/ 45 install -d $out/share/refind/fonts/ 46 install -d $out/share/refind/icons/ 47 install -d $out/share/refind/images/ 48 install -d $out/share/refind/keys/ 49 50 # refind uefi app 51 install -D -m0644 refind/refind_${efiPlatform}.efi $out/share/refind/refind_${efiPlatform}.efi 52 53 # uefi drivers 54 install -D -m0644 drivers_${efiPlatform}/*.efi $out/share/refind/drivers_${efiPlatform}/ 55 56 # uefi apps 57 install -D -m0644 gptsync/gptsync_${efiPlatform}.efi $out/share/refind/tools_${efiPlatform}/gptsync_${efiPlatform}.efi 58 59 # helper scripts 60 install -D -m0755 refind-install $out/share/refind/refind-install 61 install -D -m0755 mkrlconf $out/bin/refind-mkrlconf 62 install -D -m0755 mvrefind $out/bin/refind-mvrefind 63 install -D -m0755 fonts/mkfont.sh $out/bin/refind-mkfont 64 65 # sample config files 66 install -D -m0644 refind.conf-sample $out/share/refind/refind.conf-sample 67 68 # docs 69 install -D -m0644 docs/refind/* $out/share/refind/docs/html/ 70 install -D -m0644 docs/Styles/* $out/share/refind/docs/Styles/ 71 install -D -m0644 README.txt $out/share/refind/docs/README.txt 72 install -D -m0644 NEWS.txt $out/share/refind/docs/NEWS.txt 73 install -D -m0644 BUILDING.txt $out/share/refind/docs/BUILDING.txt 74 install -D -m0644 CREDITS.txt $out/share/refind/docs/CREDITS.txt 75 76 # fonts 77 install -D -m0644 fonts/* $out/share/refind/fonts/ 78 rm -f $out/share/refind/fonts/mkfont.sh 79 80 # icons 81 install -D -m0644 icons/*.png $out/share/refind/icons/ 82 83 # images 84 install -D -m0644 images/*.{png,bmp} $out/share/refind/images/ 85 86 # keys 87 install -D -m0644 keys/* $out/share/refind/keys/ 88 89 # The refind-install script assumes that all resource files are 90 # installed under the same directory as the script itself. To avoid 91 # having to patch around this assumption, generate a wrapper that 92 # cds into $out/share/refind and executes the real script from 93 # there. 94 cat >$out/bin/refind-install <<EOF 95#! ${stdenv.shell} 96cd $out/share/refind && exec -a $out/bin/refind-install ./refind-install \$* 97EOF 98 chmod +x $out/bin/refind-install 99 100 # Patch uses of `which`. We could patch in calls to efibootmgr, 101 # openssl, convert, and openssl, but that would greatly enlarge 102 # refind's closure (from ca 28MB to over 400MB). 103 sed -i 's,`which \(.*\)`,`type -p \1`,g' $out/share/refind/refind-install 104 sed -i 's,`which \(.*\)`,`type -p \1`,g' $out/bin/refind-mvrefind 105 sed -i 's,`which \(.*\)`,`type -p \1`,g' $out/bin/refind-mkfont 106 ''; 107 108 meta = with stdenv.lib; { 109 description = "A graphical {,U}EFI boot manager"; 110 longDescription = '' 111 rEFInd is a graphical boot manager for EFI- and UEFI-based 112 computers, such as all Intel-based Macs and recent (most 2011 113 and later) PCs. rEFInd presents a boot menu showing all the EFI 114 boot loaders on the EFI-accessible partitions, and optionally 115 BIOS-bootable partitions on Macs. EFI-compatbile OSes, including 116 Linux, provide boot loaders that rEFInd can detect and 117 launch. rEFInd can launch Linux EFI boot loaders such as ELILO, 118 GRUB Legacy, GRUB 2, and 3.3.0 and later kernels with EFI stub 119 support. EFI filesystem drivers for ext2/3/4fs, ReiserFS, HFS+, 120 and ISO-9660 enable rEFInd to read boot loaders from these 121 filesystems, too. rEFInd's ability to detect boot loaders at 122 runtime makes it very easy to use, particularly when paired with 123 Linux kernels that provide EFI stub support. 124 ''; 125 homepage = http://refind.sourceforge.net/; 126 maintainers = [ maintainers.AndersonTorres ]; 127 platforms = [ "i686-linux" "x86_64-linux" ]; 128 }; 129 130}