2024-04-26 22:24:03 +02:00
|
|
|
{ lib, stdenv, fetchFromGitLab, pkg-config, wrapGAppsHook3
|
2021-11-22 17:46:54 +01:00
|
|
|
, withLibui ? true, gtk3
|
|
|
|
, withUdisks ? stdenv.isLinux, udisks, glib
|
|
|
|
, libX11 }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "usbimager";
|
2023-10-22 01:49:24 +02:00
|
|
|
version = "1.0.10";
|
2021-11-22 17:46:54 +01:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "bztsrc";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2023-10-22 01:49:24 +02:00
|
|
|
sha256 = "sha256-HTFopc2xrhp0XYubQtOwMKWTQ+3JSKAyL4mMyQ82kAs=";
|
2021-11-22 17:46:54 +01:00
|
|
|
};
|
|
|
|
|
2023-08-08 18:24:43 +02:00
|
|
|
sourceRoot = "${src.name}/src";
|
2021-11-22 17:46:54 +01:00
|
|
|
|
2024-04-26 22:24:03 +02:00
|
|
|
nativeBuildInputs = [ pkg-config wrapGAppsHook3 ];
|
2021-11-22 17:46:54 +01:00
|
|
|
buildInputs = lib.optionals withUdisks [ udisks glib ]
|
|
|
|
++ lib.optional (!withLibui) libX11
|
|
|
|
++ lib.optional withLibui gtk3;
|
2023-06-09 15:30:00 +02:00
|
|
|
# libui is bundled with the source of usbimager as a compiled static library
|
2021-11-22 17:46:54 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2024-04-30 23:52:15 +02:00
|
|
|
postInstall = ''
|
|
|
|
substituteInPlace $out/share/applications/usbimager.desktop \
|
|
|
|
--replace-fail "Exec=/usr/bin/usbimager" "Exec=usbimager"
|
|
|
|
'';
|
|
|
|
|
2021-11-22 17:46:54 +01:00
|
|
|
dontConfigure = true;
|
|
|
|
|
|
|
|
makeFlags = [ "PREFIX=$(out)" ]
|
|
|
|
++ lib.optional withLibui "USE_LIBUI=yes"
|
|
|
|
++ lib.optional withUdisks "USE_UDISKS2=yes";
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-07 09:46:46 +02:00
|
|
|
description = "Very minimal GUI app that can write compressed disk images to USB drives";
|
2021-11-22 17:46:54 +01:00
|
|
|
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;
|
2022-12-06 21:47:40 +01:00
|
|
|
# never built on aarch64-linux since first introduction in nixpkgs
|
|
|
|
broken = stdenv.isLinux && stdenv.isAarch64;
|
2023-11-27 02:17:53 +01:00
|
|
|
mainProgram = "usbimager";
|
2021-11-22 17:46:54 +01:00
|
|
|
};
|
|
|
|
}
|