18 # nohup requires vproc_priv.h from launchd
19 launchd = apple-sdk.sourceRelease "launchd";
21 oldTime_c = fetchurl {
22 url = "https://github.com/apple-oss-distributions/shell_cmds/raw/shell_cmds-207.11.1/time/time.c";
23 hash = "sha256-f7aRwIaKq6r37jpw0V+1Z/sZs5Rm7vy2S774HNBnwmY=";
25 oldTime_1 = fetchurl {
26 url = "https://github.com/apple-oss-distributions/shell_cmds/raw/shell_cmds-207.11.1/time/time.1";
27 hash = "sha256-ZIbNJPHLQVGq2tdUB6j0DEp9Hie+XUZkfuQm676Vpwc=";
31 releaseName = "shell_cmds";
38 xcodeHash = "sha256-26N7AZV/G+ryc2Nu1v91rEdb1a6jDpnj6t5rzEG2YA4=";
42 # Fix `mktemp` templates
43 substituteInPlace sh/mkbuiltins \
44 --replace-fail '-t ka' '-t ka.XXXXXX'
45 substituteInPlace sh/mktokens \
46 --replace-fail '-t ka' '-t ka.XXXXXX'
48 # Update `/etc/locate.rc` paths to point to the store.
49 for path in locate/locate/locate.updatedb.8 locate/locate/locate.rc locate/locate/updatedb.sh; do
50 substituteInPlace $path --replace-fail '/etc/locate.rc' "$out/etc/locate.rc"
53 # Use an older version of `time.c` that’s compatible with the 10.12 SDK.
54 + lib.optionalString (lib.versionOlder (lib.getVersion apple-sdk) "10.13") ''
55 cp '${oldTime_c}' time/time.c
56 cp '${oldTime_1}' time/time.1
58 + lib.optionalString (lib.versionOlder (lib.getVersion apple-sdk) "11.0") ''
59 # `rpmatch` was added in 11.0, so revert it to a simpler check on older SDKs.
60 substituteInPlace find/misc.c \
61 --replace-fail 'return (rpmatch(resp) == 1);' "return (resp[0] == 'y');"
62 # Add missing header for older SDKs.
63 sed -e '1i #include <sys/time.h>' -i w/proc_compare.c
66 env.NIX_CFLAGS_COMPILE = "-I${launchd}/liblaunch";
68 depsBuildBuild = [ clang ];
83 # xargs needs `strtonum`, which was added in 11.0.
84 ++ lib.optionals (lib.versionOlder (lib.getVersion apple-sdk) "11.0") [ libbsd ];
87 # Patch the shebangs to use `sh` from shell_cmds.
88 HOST_PATH="$out/bin" patchShebangs --host "$out/bin" "$out/libexec"
92 description = "Darwin shell commands and the Almquist shell";