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