2021-01-25 08:26:54 +00:00
|
|
|
{ lib, appleDerivation, xcbuildHook
|
2019-02-07 01:13:51 +00:00
|
|
|
, Libc, xnu, libutil }:
|
2018-04-12 22:16:49 +00:00
|
|
|
|
|
|
|
appleDerivation {
|
2018-07-06 22:53:50 +00:00
|
|
|
nativeBuildInputs = [ xcbuildHook ];
|
2019-02-07 01:13:51 +00:00
|
|
|
buildInputs = [ libutil ];
|
2018-04-12 22:16:49 +00:00
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = "-I.";
|
|
|
|
NIX_LDFLAGS = "-lutil";
|
|
|
|
patchPhase = ''
|
|
|
|
# ugly hacks for missing headers
|
|
|
|
# most are bsd related - probably should make this a drv
|
|
|
|
unpackFile ${Libc.src}
|
|
|
|
unpackFile ${xnu.src}
|
|
|
|
mkdir System sys machine i386
|
|
|
|
cp xnu-*/bsd/sys/disklabel.h sys
|
|
|
|
cp xnu-*/bsd/machine/disklabel.h machine
|
|
|
|
cp xnu-*/bsd/i386/disklabel.h i386
|
|
|
|
cp -r xnu-*/bsd/sys System
|
|
|
|
cp -r Libc-*/uuid System
|
2019-01-07 04:13:11 +00:00
|
|
|
substituteInPlace diskdev_cmds.xcodeproj/project.pbxproj \
|
|
|
|
--replace 'DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";' ""
|
2018-04-12 22:16:49 +00:00
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
install -D Products/Release/libdisk.a $out/lib/libdisk.a
|
|
|
|
rm Products/Release/libdisk.a
|
2018-12-30 05:58:10 +00:00
|
|
|
for f in Products/Release/*; do
|
|
|
|
if [ -f $f ]; then
|
2019-01-07 04:13:11 +00:00
|
|
|
install -D $f $out/bin/$(basename $f)
|
|
|
|
fi
|
2018-04-12 22:16:49 +00:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2021-01-15 14:45:37 +00:00
|
|
|
platforms = lib.platforms.darwin;
|
|
|
|
maintainers = with lib.maintainers; [ matthewbauer ];
|
2018-04-12 22:16:49 +00:00
|
|
|
};
|
|
|
|
}
|