summary refs log tree commit diff
path: root/pkgs/tools/cd-dvd/unetbootin/default.nix
blob: 71a0a763285ae592a7897e935867ffce2860a627 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{ lib, stdenv, fetchFromGitHub, makeWrapper, qt4, util-linux, coreutils, which, qmake4Hook
, p7zip, mtools, syslinux }:

stdenv.mkDerivation rec {
  pname = "unetbootin";
  version = "681";

  src = fetchFromGitHub {
    owner  = "unetbootin";
    repo   = "unetbootin";
    rev    = version;
    sha256 = "0ppqb7ywh4cpcjr5nw6f65dx4s8kx09gnhihnby3zjhxdf4l99fm";
  };

  setSourceRoot = ''
    sourceRoot=$(echo */src/unetbootin)
  '';

  buildInputs = [ qt4 ];
  nativeBuildInputs = [ makeWrapper qmake4Hook ];
  enableParallelBuilding = true;

  # Lots of nice hard-coded paths...
  postPatch = ''
    substituteInPlace unetbootin.cpp \
      --replace /bin/df             ${coreutils}/bin/df \
      --replace /sbin/blkid         ${util-linux}/sbin/blkid \
      --replace /sbin/fdisk         ${util-linux}/sbin/fdisk \
      --replace /sbin/sfdisk        ${util-linux}/sbin/sfdisk \
      --replace /usr/bin/syslinux   ${syslinux}/bin/syslinux \
      --replace /usr/bin/extlinux   ${syslinux}/sbin/extlinux \
      --replace /usr/share/syslinux ${syslinux}/share/syslinux

    substituteInPlace main.cpp \
      --replace /usr/share/unetbootin $out/share/unetbootin

    substituteInPlace unetbootin.desktop \
      --replace /usr/bin $out/bin
  '';

  preConfigure = ''
    lupdate unetbootin.pro
    lrelease unetbootin.pro
  '';

  installPhase = ''
    runHook preInstall

    install -Dm755 -t $out/bin                unetbootin
    install -Dm644 -t $out/share/unetbootin   unetbootin_*.qm
    install -Dm644 -t $out/share/applications unetbootin.desktop

    wrapProgram $out/bin/unetbootin \
      --prefix PATH : ${lib.makeBinPath [ mtools p7zip which ]} \
      --set QT_X11_NO_MITSHM 1

    runHook postInstall
  '';

  meta = with lib; {
    homepage    = "http://unetbootin.sourceforge.net/";
    description = "A tool to create bootable live USB drives from ISO images";
    license     = licenses.gpl2Plus;
    platforms   = platforms.linux;
    maintainers = with maintainers; [ ebzzry ];
  };
}