nixpkgs/pkgs/tools/misc/woeusb/default.nix
Gleb Peregud bea10bfcab woeusb: add p7zip to runtime deps
* woeusb: add p7zip to runtime deps enable extra feature (#47982)

WoeUSB depends on presence of '7z` binary in the path to execute an extra step. 
As Windows 7's installation media doesn't place the required EFI bootloaders
in the right location, WoeUSB extracts them from the system image manually
using '7z' binary which it checks with 'command -v 7z'.

See related code at:
aea4f91783/src/woeusb (L1530)

* woeusb: split native build inputs
2018-11-25 11:24:31 +01:00

59 lines
1.9 KiB
Nix

{ stdenv, fetchFromGitHub, autoreconfHook, makeWrapper
, coreutils, dosfstools, findutils, gawk, gnugrep, grub2_light, ncurses, ntfs3g, parted, p7zip, utillinux, wget
, wxGTK30 }:
stdenv.mkDerivation rec {
version = "3.2.10";
name = "woeusb-${version}";
src = fetchFromGitHub {
owner = "slacka";
repo = "WoeUSB";
rev = "v${version}";
sha256 = "0jzgwh9xv92yns5yi5zpl49zbp3csh6m6iclgq070awpjpsqlqi0";
};
nativeBuildInputs = [ autoreconfHook makeWrapper ];
buildInputs = [ wxGTK30 ];
postPatch = ''
# Emulate version smudge filter (see .gitattributes, .gitconfig).
for file in configure.ac debian/changelog src/woeusb src/woeusb.1 src/woeusbgui.1; do
substituteInPlace "$file" \
--replace '@@WOEUSB_VERSION@@' '${version}'
done
substituteInPlace src/MainPanel.cpp \
--replace "'woeusb " "'$out/bin/woeusb "
'';
postInstall = ''
# don't write data into /
substituteInPlace "$out/bin/woeusb" \
--replace /media/ /run/woeusb/
# woeusbgui launches woeusb with pkexec, which sets
# PATH=/usr/sbin:/usr/bin:/sbin:/bin:/root/bin. Perhaps pkexec
# should be patched with a less useless default PATH, but for now
# we add everything we need manually.
wrapProgram "$out/bin/woeusb" \
--set PATH '${stdenv.lib.makeBinPath [ coreutils dosfstools findutils gawk gnugrep grub2_light ncurses ntfs3g parted utillinux wget p7zip ]}'
'';
doInstallCheck = true;
postInstallCheck = ''
# woeusb --version checks for missing runtime dependencies.
out_version="$("$out/bin/woeusb" --version)"
[ "$out_version" = '${version}' ]
'';
meta = with stdenv.lib; {
description = "Create bootable USB disks from Windows ISO images";
homepage = https://github.com/slacka/WoeUSB;
license = licenses.gpl3;
maintainers = with maintainers; [ bjornfor gnidorah ];
platforms = platforms.linux;
};
}