about summary refs log tree commit diff
path: root/pkgs/tools/misc/usbimager
diff options
context:
space:
mode:
authorVictor Buttner <victor@0x23.dk>2021-11-22 17:46:54 +0100
committerVictor Buttner <victor@0x23.dk>2022-05-05 09:57:33 +0200
commitf2bb2d0c3bc699fa74798c993fc5d05a802f94eb (patch)
tree928cb9e074a1e6d53c461b440dccf2d724f86eab /pkgs/tools/misc/usbimager
parent859f7617a7e04a49488154e9cc5dfcfd157c38fa (diff)
usbimager: init at 1.0.8
Diffstat (limited to 'pkgs/tools/misc/usbimager')
-rw-r--r--pkgs/tools/misc/usbimager/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/tools/misc/usbimager/default.nix b/pkgs/tools/misc/usbimager/default.nix
new file mode 100644
index 0000000000000..1aac4c5c80242
--- /dev/null
+++ b/pkgs/tools/misc/usbimager/default.nix
@@ -0,0 +1,47 @@
+{ lib, stdenv, fetchFromGitLab, pkg-config
+, withLibui ? true, gtk3
+, withUdisks ? stdenv.isLinux, udisks, glib
+, libX11 }:
+
+stdenv.mkDerivation rec {
+  pname = "usbimager";
+  version = "1.0.8";
+
+  src = fetchFromGitLab {
+    owner = "bztsrc";
+    repo = pname;
+    rev = version;
+    sha256 = "1j0g1anmdwc3pap3m4kfzqjfkn7q0vpmqniii2kcz7svs5h3ybga";
+  };
+
+  sourceRoot = "source/src/";
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = lib.optionals withUdisks [ udisks glib ]
+    ++ lib.optional (!withLibui) libX11
+    ++ lib.optional withLibui gtk3;
+    # libui is bundled with the source of usbimager as a compiled static libary
+
+  postPatch = ''
+    sed -i \
+      -e 's|install -m 2755 -g disk|install |g' \
+      -e 's|-I/usr/include/gio-unix-2.0|-I${glib.dev}/include/gio-unix-2.0|g' \
+      -e 's|install -m 2755 -g $(GRP)|install |g' Makefile
+  '';
+
+  dontConfigure = true;
+
+  makeFlags =  [ "PREFIX=$(out)" ]
+    ++ lib.optional withLibui "USE_LIBUI=yes"
+    ++ lib.optional withUdisks "USE_UDISKS2=yes";
+
+  meta = with lib; {
+    description = "A very minimal GUI app that can write compressed disk images to USB drives";
+    homepage = "https://gitlab.com/bztsrc/usbimager";
+    license = licenses.mit;
+    maintainers = with maintainers; [ vdot0x23 ];
+    # windows and darwin could work, but untested
+    # feel free add them if you have a machine to test
+    platforms = with platforms; linux;
+  };
+}