about summary refs log tree commit diff
path: root/pkgs/tools/misc/woeusb/default.nix
diff options
context:
space:
mode:
authorAnders Kaseorg <andersk@mit.edu>2017-12-22 00:20:11 -0500
committerAnders Kaseorg <andersk@mit.edu>2017-12-22 03:32:44 -0500
commit4ef36bf65494b6f0117dec6d238ac4575461d6b0 (patch)
tree6f1c0ab714932aceb4144e776d3ccbe09e6c1ec9 /pkgs/tools/misc/woeusb/default.nix
parentab623d8467c9f82666e8a6f7ee48eae9199acb5e (diff)
downloadnixlib-4ef36bf65494b6f0117dec6d238ac4575461d6b0.tar
nixlib-4ef36bf65494b6f0117dec6d238ac4575461d6b0.tar.gz
nixlib-4ef36bf65494b6f0117dec6d238ac4575461d6b0.tar.bz2
nixlib-4ef36bf65494b6f0117dec6d238ac4575461d6b0.tar.lz
nixlib-4ef36bf65494b6f0117dec6d238ac4575461d6b0.tar.xz
nixlib-4ef36bf65494b6f0117dec6d238ac4575461d6b0.tar.zst
nixlib-4ef36bf65494b6f0117dec6d238ac4575461d6b0.zip
winusb: unstable-2017-01-30 -> woeusb 3.1.4
WinUSB was renamed to WoeUSB
(https://github.com/slacka/WoeUSB/issues/100).

Also, put mount points in /run instead of /tmp to sidestep security
considerations with /tmp.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Diffstat (limited to 'pkgs/tools/misc/woeusb/default.nix')
-rw-r--r--pkgs/tools/misc/woeusb/default.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/pkgs/tools/misc/woeusb/default.nix b/pkgs/tools/misc/woeusb/default.nix
new file mode 100644
index 000000000000..436a252e678d
--- /dev/null
+++ b/pkgs/tools/misc/woeusb/default.nix
@@ -0,0 +1,57 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, makeWrapper
+, coreutils, dosfstools, findutils, gawk, gnugrep, grub2_light, ncurses, ntfs3g, parted, utillinux, wget
+, wxGTK30 }:
+
+stdenv.mkDerivation rec {
+  version = "3.1.4";
+  name = "woeusb-${version}";
+
+  src = fetchFromGitHub {
+    owner = "slacka";
+    repo = "WoeUSB";
+    rev = "v${version}";
+    sha256 = "0hvxsm6k6s29wnr3i5b9drf6ml0i32is2l50l3cxvf1f499w4bpc";
+  };
+
+  buildInputs = [ wxGTK30 autoreconfHook makeWrapper ];
+
+  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 ]}'
+  '';
+
+  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;
+  };
+}