1{
2 lib,
3 stdenv,
4 coreutils,
5 fetchFromGitHub,
6 mtools,
7 p7zip,
8 wrapQtAppsHook,
9 qtbase,
10 qttools,
11 qmake,
12 syslinux,
13 util-linux,
14 which,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "unetbootin";
19 version = "702";
20
21 src = fetchFromGitHub {
22 owner = pname;
23 repo = pname;
24 rev = version;
25 sha256 = "sha256-psX15XicPXAsd36BhuvK0G3GQS8hV/hazzO0HByCqV4=";
26 };
27
28 setSourceRoot = ''
29 sourceRoot=$(echo */src/unetbootin)
30 '';
31
32 buildInputs = [
33 qtbase
34 qttools
35 qmake
36 ];
37
38 nativeBuildInputs = [ wrapQtAppsHook ];
39
40 # Lots of nice hard-coded paths...
41 postPatch = ''
42 substituteInPlace unetbootin.cpp \
43 --replace /bin/df ${coreutils}/bin/df \
44 --replace /sbin/blkid ${util-linux}/sbin/blkid \
45 --replace /sbin/fdisk ${util-linux}/sbin/fdisk \
46 --replace /sbin/sfdisk ${util-linux}/sbin/sfdisk \
47 --replace /usr/bin/syslinux ${syslinux}/bin/syslinux \
48 --replace /usr/bin/extlinux ${syslinux}/sbin/extlinux \
49 --replace /usr/share/syslinux ${syslinux}/share/syslinux
50
51 substituteInPlace main.cpp \
52 --replace /usr/share/unetbootin $out/share/unetbootin
53
54 substituteInPlace unetbootin.desktop \
55 --replace /usr/bin $out/bin
56 '';
57
58 preConfigure = ''
59 lupdate unetbootin.pro
60 lrelease unetbootin.pro
61 '';
62
63 installPhase = ''
64 runHook preInstall
65
66 install -Dm755 -t $out/bin unetbootin
67 install -Dm644 -t $out/share/unetbootin unetbootin_*.qm
68 install -Dm644 -t $out/share/applications unetbootin.desktop
69
70 runHook postInstall
71 '';
72
73 qtWrapperArgs = [
74 "--prefix PATH : ${
75 lib.makeBinPath [
76 mtools
77 p7zip
78 which
79 ]
80 }"
81 "--set QT_X11_NO_MITSHM 1"
82 ];
83
84 meta = with lib; {
85 description = "Tool to create bootable live USB drives from ISO images";
86 homepage = "https://unetbootin.github.io/";
87 license = licenses.gpl2Plus;
88 maintainers = with maintainers; [ ebzzry ];
89 platforms = platforms.linux;
90 mainProgram = "unetbootin";
91 };
92}