1 { lib, runCommandLocal }:
3 # On darwin, there are some commands neither opensource nor able to build in nixpkgs.
4 # We have no choice but to use those system-shipped impure ones.
8 ditto = "/usr/bin/ditto"; # ditto is not opensource
9 sudo = "/usr/bin/sudo"; # sudo must be owned by uid 0 and have the setuid bit set
12 mkImpureDrv = name: path:
13 runCommandLocal "${name}-impure-darwin" {
14 __impureHostDeps = [ path ];
17 platforms = lib.platforms.darwin;
20 if ! [ -x ${path} ]; then
21 echo Cannot find command ${path}
26 ln -s ${path} $out/bin
28 manpage="/usr/share/man/man1/${name}.1"
29 if [ -f $manpage ]; then
30 mkdir -p $out/share/man/man1
31 ln -s $manpage $out/share/man/man1
34 in lib.mapAttrs mkImpureDrv commands