nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 68 lines 1.9 kB view raw
1{ 2 lib, 3 apple-sdk, 4 libutil, 5 mkAppleDerivation, 6 removefile, 7 stdenvNoCC, 8}: 9 10let 11 Libc = apple-sdk.sourceRelease "Libc"; 12 xnu = apple-sdk.sourceRelease "xnu"; 13 14 privateHeaders = stdenvNoCC.mkDerivation { 15 name = "diskdev_cmds-deps-private-headers"; 16 17 buildCommand = '' 18 for dir in arm i386 machine sys; do 19 install -D -t "$out/include/$dir" '${xnu}'"/bsd/$dir/disklabel.h" 20 done 21 install -D -t "$out/include/os" \ 22 '${Libc}/os/api.h' \ 23 '${Libc}/os/variant_private.h' \ 24 '${Libc}/libdarwin/h/bsd.h' \ 25 '${Libc}/libdarwin/h/errno.h' 26 install -D -t "$out/include/System/sys" \ 27 '${xnu}/bsd/sys/fsctl.h' \ 28 '${xnu}/bsd/sys/reason.h' 29 install -D -t "$out/include/System/uuid" \ 30 '${Libc}/uuid/namespace.h' 31 mkdir -p "$out/include/APFS" 32 touch "$out/include/APFS/APFS.h" 33 touch "$out/include/APFS/APFSConstants.h" 34 35 substituteInPlace "$out/include/os/variant_private.h" \ 36 --replace-fail ', bridgeos(4.0)' "" \ 37 --replace-fail ', bridgeos' "" 38 ''; 39 }; 40in 41mkAppleDerivation { 42 releaseName = "diskdev_cmds"; 43 44 outputs = [ 45 "out" 46 "man" 47 ]; 48 49 xcodeHash = "sha256-P2dg3B5pU2ayasMHIM5nI0iG+YDdYQNcEpnJzZxm1kw="; 50 51 postPatch = 52 # Fix incompatible pointer to integer conversion. The last parameter is size_t not a pointer. 53 # https://developer.apple.com/documentation/kernel/1387446-sysctlbyname 54 '' 55 substituteInPlace mount.tproj/mount.c \ 56 --replace-fail 'sysctlbyname ("vfs.generic.apfs.rosp", &is_rosp, &rospsize, NULL, NULL);' 'sysctlbyname ("vfs.generic.apfs.rosp", &is_rosp, &rospsize, NULL, 0);' 57 ''; 58 59 env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include"; 60 61 buildInputs = [ 62 apple-sdk.privateFrameworksHook 63 libutil 64 removefile 65 ]; 66 67 meta.description = "Disk commands for Darwin"; 68}