diff --git a/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix b/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix index 37830c0665e1..d17db5a345a8 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix @@ -1,67 +1,32 @@ -{ lib, stdenv, appleDerivation', launchd, bootstrap_cmds, xnu, ppp, IOKit, eap8021x, Security +{ lib, stdenv, appleDerivation', launchd, bootstrap_cmds, xnu, xpc, ppp, IOKit, eap8021x, Security , headersOnly ? false }: appleDerivation' stdenv { meta.broken = stdenv.cc.nativeLibc; nativeBuildInputs = lib.optionals (!headersOnly) [ bootstrap_cmds ]; - buildInputs = lib.optionals (!headersOnly) [ launchd ppp IOKit eap8021x ]; + buildInputs = lib.optionals (!headersOnly) [ launchd ppp xpc IOKit eap8021x ]; propagatedBuildInputs = lib.optionals (!headersOnly) [ Security ]; + env = lib.optionalAttrs (!headersOnly) { + NIX_CFLAGS_COMPILE = toString [ + "-ISystemConfiguration.framework/Headers" + "-I${xnu}/Library/Frameworks/System.framework/Versions/B/PrivateHeaders" + ]; + }; + patchPhase = lib.optionalString (!headersOnly) '' - HACK=$PWD/hack - mkdir $HACK - cp -r ${xnu}/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/net $HACK - - - substituteInPlace SystemConfiguration.fproj/SCNetworkReachabilityInternal.h \ - --replace '#include ' "" + substituteInPlace SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_client.c \ + --replace '#include ' "" substituteInPlace SystemConfiguration.fproj/SCNetworkReachability.c \ --replace ''$'#define\tHAVE_VPN_STATUS' "" - substituteInPlace SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_client.c \ - --replace '#include ' '#include "fake_xpc.h"' \ - --replace '#include ' "" \ - # Our neutered CoreFoundation doesn't have this function, but I think we'll live... substituteInPlace SystemConfiguration.fproj/SCNetworkConnectionPrivate.c \ --replace 'CFPreferencesAppValueIsForced(serviceID, USER_PREFERENCES_APPLICATION_ID)' 'FALSE' \ --replace 'CFPreferencesAppValueIsForced(userPrivate->serviceID, USER_PREFERENCES_APPLICATION_ID)' 'FALSE' - - cat >SystemConfiguration.fproj/fake_xpc.h <