btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / wo / woeusb / package.nix
blob9add255896f7578b833510dcce8b20d7c3c980f5
1 { lib, stdenv, fetchFromGitHub, installShellFiles, makeWrapper
2 , coreutils, dosfstools, findutils, gawk, gnugrep, grub2_light, ncurses, ntfs3g, parted, p7zip, util-linux, wimlib, wget }:
4 stdenv.mkDerivation rec {
5   version = "5.2.4";
6   pname = "woeusb";
8   src = fetchFromGitHub {
9     owner = "WoeUSB";
10     repo = "WoeUSB";
11     rev = "v${version}";
12     sha256 = "sha256-HB1E7rP/U58dyL3j6YnhF5AOGAcHqmA/ZZ5JNBDibco=";
13   };
15   nativeBuildInputs = [ installShellFiles makeWrapper ];
17   postPatch = ''
18     # Emulate version smudge filter (see .gitattributes, .gitconfig).
19     for file in sbin/woeusb share/man/man1/woeusb.1; do
20       substituteInPlace "$file" \
21         --replace '@@WOEUSB_VERSION@@' '${version}'
22     done
23   '';
25   installPhase = ''
26     runHook preInstall
28     mkdir -p $out/bin
29     mv sbin/woeusb $out/bin
30     installManPage share/man/man1/woeusb.1
32     wrapProgram "$out/bin/woeusb" \
33       --set PATH '${lib.makeBinPath [ coreutils dosfstools findutils gawk gnugrep grub2_light ncurses ntfs3g parted p7zip util-linux wget wimlib ]}'
35     runHook postInstall
36   '';
38   doInstallCheck = true;
40   postInstallCheck = ''
41     # woeusb --version checks for missing runtime dependencies.
42     out_version="$("$out/bin/woeusb" --version)"
43     [ "$out_version" = '${version}' ]
44   '';
46   meta = with lib; {
47     description = "Create bootable USB disks from Windows ISO images";
48     homepage = "https://github.com/WoeUSB/WoeUSB";
49     license = licenses.gpl3Plus;
50     maintainers = with maintainers; [ bjornfor ];
51     platforms = platforms.linux;
52     mainProgram = "woeusb";
53   };