@@ -0,0 +1,45 @@
1+{ stdenv, fetchurl, openssl, libbsd }:
2+
3+let version = "332.25";
4+ package_name = "hfsprogs"; in
5+stdenv.mkDerivation rec {
6+ name = "${package_name}-${version}";
7+ srcs = [
8+ (fetchurl {
9+ url = "http://ftp.de.debian.org/debian/pool/main/h/hfsprogs/${package_name}_${version}-11.debian.tar.gz";
10+ sha256 = "62d9b8599c66ebffbc57ce5d776e20b41341130d9b27341d63bda08460ebde7c";
11+ })
12+ (fetchurl {
13+ url = "https://opensource.apple.com/tarballs/diskdev_cmds/diskdev_cmds-${version}.tar.gz";
14+ sha256 = "74c9aeca899ed7f4bf155c65fc45bf0f250c0f6d57360ea953b1d536d9aa45e6";
15+ })
16+ ];
17+
18+ sourceRoot = "diskdev_cmds-" + version;
19+ patches = [ "../debian/patches/*.patch" ];
20+
21+ buildInputs = [ openssl libbsd ];
22+ makefile = "Makefile.lnx";
23+
24+ # Inspired by PKGBUILD of https://www.archlinux.org/packages/community/x86_64/hfsprogs/
25+ installPhase = ''
26+ # Create required package directories
27+ install -m 755 -d "$out/bin"
28+ install -m 755 -d "$out/share/${package_name}"
29+ install -m 755 -d "$out/share/man/man8/"
30+ # Copy executables
31+ install -m 755 "newfs_hfs.tproj/newfs_hfs" "$out/bin/mkfs.hfsplus"
32+ install -m 755 "fsck_hfs.tproj/fsck_hfs" "$out/bin/fsck.hfsplus"
33+ # Copy shared data
34+ install -m 644 "newfs_hfs.tproj/hfsbootdata.img" "$out/share/${package_name}/hfsbootdata"
35+ # Copy man pages
36+ install -m 644 "newfs_hfs.tproj/newfs_hfs.8" "$out/share/man/man8/mkfs.hfsplus.8"
37+ install -m 644 "fsck_hfs.tproj/fsck_hfs.8" "$out/share/man/man8/fsck.hfsplus.8"
38+ '';
39+
40+ meta = {
41+ description = "HFS/HFS+ user space utils";
42+ license = stdenv.lib.licenses.apsl20;
43+ platforms = stdenv.lib.platforms.linux;
44+ };
45+}