btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / us / usbimager / package.nix
blob11a9162af2f233f8219b19107d5681292c269ef5
1 { lib, stdenv, fetchFromGitLab, pkg-config, wrapGAppsHook3
2 , withLibui ? true, gtk3
3 , withUdisks ? stdenv.hostPlatform.isLinux, udisks, glib
4 , libX11 }:
6 stdenv.mkDerivation rec {
7   pname = "usbimager";
8   version = "1.0.10";
10   src = fetchFromGitLab {
11     owner = "bztsrc";
12     repo = pname;
13     rev = version;
14     hash = "sha256-HTFopc2xrhp0XYubQtOwMKWTQ+3JSKAyL4mMyQ82kAs=";
15   };
17   sourceRoot = "${src.name}/src";
19   nativeBuildInputs = [ pkg-config wrapGAppsHook3 ];
20   buildInputs = lib.optionals withUdisks [ udisks glib ]
21     ++ lib.optional (!withLibui) libX11
22     ++ lib.optional withLibui gtk3;
23     # libui is bundled with the source of usbimager as a compiled static library
25   postPatch = ''
26     sed -i \
27       -e 's|install -m 2755 -g disk|install |g' \
28       -e 's|-I/usr/include/gio-unix-2.0|-I${glib.dev}/include/gio-unix-2.0|g' \
29       -e 's|install -m 2755 -g $(GRP)|install |g' Makefile
30   '';
32   postInstall = ''
33     substituteInPlace $out/share/applications/usbimager.desktop \
34       --replace-fail "Exec=/usr/bin/usbimager" "Exec=usbimager"
35   '';
37   dontConfigure = true;
39   makeFlags =  [ "PREFIX=$(out)" ]
40     ++ lib.optional withLibui "USE_LIBUI=yes"
41     ++ lib.optional withUdisks "USE_UDISKS2=yes";
43   meta = with lib; {
44     description = "Very minimal GUI app that can write compressed disk images to USB drives";
45     homepage = "https://gitlab.com/bztsrc/usbimager";
46     license = licenses.mit;
47     maintainers = with maintainers; [ vdot0x23 ];
48     # windows and darwin could work, but untested
49     # feel free add them if you have a machine to test
50     platforms = with platforms; linux;
51     # never built on aarch64-linux since first introduction in nixpkgs
52     broken = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64;
53     mainProgram = "usbimager";
54   };