nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 apple-sdk,
4 bison,
5 clang,
6 libedit,
7 libresolv,
8 libsbuf,
9 libutil,
10 libxo,
11 pkg-config,
12 mkAppleDerivation,
13}:
14
15let
16 # nohup requires vproc_priv.h from launchd
17 launchd = apple-sdk.sourceRelease "launchd";
18in
19mkAppleDerivation {
20 releaseName = "shell_cmds";
21
22 outputs = [
23 "out"
24 "man"
25 ];
26
27 xcodeHash = "sha256-26N7AZV/G+ryc2Nu1v91rEdb1a6jDpnj6t5rzEG2YA4=";
28
29 postPatch = ''
30 # Fix `mktemp` templates
31 substituteInPlace sh/mkbuiltins \
32 --replace-fail '-t ka' '-t ka.XXXXXX'
33 substituteInPlace sh/mktokens \
34 --replace-fail '-t ka' '-t ka.XXXXXX'
35
36 # Update `/etc/locate.rc` paths to point to the store.
37 for path in locate/locate/locate.updatedb.8 locate/locate/locate.rc locate/locate/updatedb.sh; do
38 substituteInPlace $path --replace-fail '/etc/locate.rc' "$out/etc/locate.rc"
39 done
40 '';
41
42 env.NIX_CFLAGS_COMPILE = "-I${launchd}/liblaunch";
43
44 depsBuildBuild = [ clang ];
45
46 nativeBuildInputs = [
47 bison
48 pkg-config
49 ];
50
51 buildInputs = [
52 libedit
53 libresolv
54 libsbuf
55 libutil
56 libxo
57 ];
58
59 postInstall = ''
60 # Patch the shebangs to use `sh` from shell_cmds.
61 HOST_PATH="$out/bin" patchShebangs --host "$out/bin" "$out/libexec"
62 '';
63
64 meta = {
65 description = "Darwin shell commands and the Almquist shell";
66 license = [
67 lib.licenses.bsd2
68 lib.licenses.bsd3
69 ];
70 };
71}