@@ -0,0 +1,50 @@
1+{ stdenv, lib, fetchurl, pkgs, makeWrapper, bash
2+, cabextract ? null
3+, cdrkit ? null
4+, mtools ? null
5+, ntfs3g ? null
6+, syslinux ? null
7+}:
8+
9+stdenv.mkDerivation rec {
10+ version = "1.12.0";
11+ name = "wimlib-${version}";
12+
13+ nativeBuildInputs = with pkgs; [ pkgconfig makeWrapper ];
14+ buildInputs = with pkgs; [ openssl fuse libxml2 ntfs3g ];
15+
16+ src = fetchurl {
17+ url = "https://wimlib.net/downloads/${name}.tar.gz";
18+ sha256 = "852cf59d682a91974f715f09fa98cab621b740226adcfea7a42360be0f86464f";
19+ };
20+
21+ prefixPackages = [ cabextract cdrkit mtools ntfs3g syslinux ];
22+
23+ preBuild = ''
24+ substituteInPlace programs/mkwinpeimg.in --replace '/usr/lib/syslinux' "${syslinux}/share/syslinux"
25+ '';
26+
27+ postInstall = ''
28+ for prog in $out/bin/*; do
29+ wrapProgram $prog --prefix PATH : ${lib.makeBinPath prefixPackages}
30+ done
31+ '';
32+
33+ doCheck = true;
34+
35+ checkPhase = ''
36+ patchShebangs tests/
37+ for testfile in tests/test-*; do
38+ wrapProgram $testfile --prefix PATH : ${lib.makeBinPath prefixPackages}
39+ done
40+ make check
41+ '';
42+
43+ meta = with lib; {
44+ homepage = https://wimlib.net;
45+ description = "A library and program to extract, create, and modify WIM files";
46+ platforms = platforms.unix;
47+ maintainers = with maintainers; [ andir ];
48+ license = with licenses; [ gpl3 lgpl3 cc0 ];
49+ };
50+}