Files
nixpkgs/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

69 lines
1.8 KiB
Nix

{
lib,
apple-sdk,
libutil,
mkAppleDerivation,
removefile,
stdenvNoCC,
}:
let
Libc = apple-sdk.sourceRelease "Libc";
xnu = apple-sdk.sourceRelease "xnu";
privateHeaders = stdenvNoCC.mkDerivation {
name = "diskdev_cmds-deps-private-headers";
buildCommand = ''
for dir in arm i386 machine sys; do
install -D -t "$out/include/$dir" '${xnu}'"/bsd/$dir/disklabel.h"
done
install -D -t "$out/include/os" \
'${Libc}/os/api.h' \
'${Libc}/os/variant_private.h' \
'${Libc}/libdarwin/h/bsd.h' \
'${Libc}/libdarwin/h/errno.h'
install -D -t "$out/include/System/sys" \
'${xnu}/bsd/sys/fsctl.h' \
'${xnu}/bsd/sys/reason.h'
install -D -t "$out/include/System/uuid" \
'${Libc}/uuid/namespace.h'
mkdir -p "$out/include/APFS"
touch "$out/include/APFS/APFS.h"
touch "$out/include/APFS/APFSConstants.h"
substituteInPlace "$out/include/os/variant_private.h" \
--replace-fail ', bridgeos(4.0)' "" \
--replace-fail ', bridgeos' ""
'';
};
in
mkAppleDerivation {
releaseName = "diskdev_cmds";
outputs = [
"out"
"man"
];
xcodeHash = "sha256-P2dg3B5pU2ayasMHIM5nI0iG+YDdYQNcEpnJzZxm1kw=";
postPatch =
# Fix incompatible pointer to integer conversion. The last parameter is size_t not a pointer.
# https://developer.apple.com/documentation/kernel/1387446-sysctlbyname
''
substituteInPlace mount.tproj/mount.c \
--replace-fail 'sysctlbyname ("vfs.generic.apfs.rosp", &is_rosp, &rospsize, NULL, NULL);' 'sysctlbyname ("vfs.generic.apfs.rosp", &is_rosp, &rospsize, NULL, 0);'
'';
env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include";
buildInputs = [
apple-sdk.privateFrameworksHook
libutil
removefile
];
meta.description = "Disk commands for Darwin";
}