nixpkgs/pkgs/tools/misc/usbimager/default.nix

50 lines
1.5 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitLab, pkg-config, wrapGAppsHook
2021-11-22 16:46:54 +00:00
, withLibui ? true, gtk3
, withUdisks ? stdenv.isLinux, udisks, glib
, libX11 }:
stdenv.mkDerivation rec {
pname = "usbimager";
2023-01-28 03:33:53 +00:00
version = "1.0.9";
2021-11-22 16:46:54 +00:00
src = fetchFromGitLab {
owner = "bztsrc";
repo = pname;
rev = version;
2023-01-28 03:33:53 +00:00
sha256 = "sha256-CEGUXJXqXmD8uT93T9dg49Lf5vTpAzQjdnhYmbR5zTI=";
2021-11-22 16:46:54 +00:00
};
sourceRoot = "${src.name}/src";
2021-11-22 16:46:54 +00:00
nativeBuildInputs = [ pkg-config wrapGAppsHook ];
2021-11-22 16:46:54 +00:00
buildInputs = lib.optionals withUdisks [ udisks glib ]
++ lib.optional (!withLibui) libX11
++ lib.optional withLibui gtk3;
2023-06-09 13:30:00 +00:00
# libui is bundled with the source of usbimager as a compiled static library
2021-11-22 16:46:54 +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
'';
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;
# never built on aarch64-linux since first introduction in nixpkgs
broken = stdenv.isLinux && stdenv.isAarch64;
2021-11-22 16:46:54 +00:00
};
}