{ lib, stdenv, appleDerivation', launchd, bootstrap_cmds, xnu, 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 ]; propagatedBuildInputs = lib.optionals (!headersOnly) [ Security ]; 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/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 </dev/null mkdir -p SystemConfiguration.framework/Resources cp ../get-mobility-info SystemConfiguration.framework/Resources cp Info.plist SystemConfiguration.framework/Resources cp -r English.lproj SystemConfiguration.framework/Resources cp NetworkConfiguration.plist SystemConfiguration.framework/Resources mkdir -p SystemConfiguration.framework/Headers mkdir -p SystemConfiguration.framework/PrivateHeaders # The standard public headers cp SCSchemaDefinitions.h SystemConfiguration.framework/Headers cp SystemConfiguration.h SystemConfiguration.framework/Headers cp SCDynamicStore.h SystemConfiguration.framework/Headers cp SCDynamicStoreCopySpecific.h SystemConfiguration.framework/Headers cp SCPreferences.h SystemConfiguration.framework/Headers cp CaptiveNetwork.h SystemConfiguration.framework/Headers cp SCPreferencesPath.h SystemConfiguration.framework/Headers cp SCDynamicStoreKey.h SystemConfiguration.framework/Headers cp SCPreferencesSetSpecific.h SystemConfiguration.framework/Headers cp SCNetworkConfiguration.h SystemConfiguration.framework/Headers cp SCNetworkConnection.h SystemConfiguration.framework/Headers cp SCNetworkReachability.h SystemConfiguration.framework/Headers cp DHCPClientPreferences.h SystemConfiguration.framework/Headers cp SCNetwork.h SystemConfiguration.framework/Headers cp SCDynamicStoreCopyDHCPInfo.h SystemConfiguration.framework/Headers # TODO: Do we want to preserve private headers or just make them public? cp SCDPlugin.h SystemConfiguration.framework/PrivateHeaders cp SCPrivate.h SystemConfiguration.framework/PrivateHeaders cp SCDynamicStorePrivate.h SystemConfiguration.framework/PrivateHeaders cp SCDynamicStoreCopySpecificPrivate.h SystemConfiguration.framework/PrivateHeaders cp SCDynamicStoreSetSpecificPrivate.h SystemConfiguration.framework/PrivateHeaders cp SCValidation.h SystemConfiguration.framework/PrivateHeaders cp SCPreferencesPrivate.h SystemConfiguration.framework/PrivateHeaders cp DeviceOnHold.h SystemConfiguration.framework/PrivateHeaders cp LinkConfiguration.h SystemConfiguration.framework/PrivateHeaders cp SCPreferencesPathKey.h SystemConfiguration.framework/PrivateHeaders cp SCPreferencesSetSpecificPrivate.h SystemConfiguration.framework/PrivateHeaders cp SCNetworkConnectionPrivate.h SystemConfiguration.framework/PrivateHeaders cp SCPreferencesGetSpecificPrivate.h SystemConfiguration.framework/PrivateHeaders cp SCSchemaDefinitionsPrivate.h SystemConfiguration.framework/PrivateHeaders cp SCNetworkConfigurationPrivate.h SystemConfiguration.framework/PrivateHeaders cp SCPreferencesKeychainPrivate.h SystemConfiguration.framework/PrivateHeaders cp SCNetworkSignature.h SystemConfiguration.framework/PrivateHeaders cp SCNetworkSignaturePrivate.h SystemConfiguration.framework/PrivateHeaders cp VPNPrivate.h SystemConfiguration.framework/PrivateHeaders cp VPNConfiguration.h SystemConfiguration.framework/PrivateHeaders cp VPNTunnelPrivate.h SystemConfiguration.framework/PrivateHeaders cp VPNTunnel.h SystemConfiguration.framework/PrivateHeaders mkdir derived cat >derived/SystemConfiguration_vers.c </dev/null ''; installPhase = '' mkdir -p $out/include cp dnsinfo/*.h $out/include/ '' + lib.optionalString (!headersOnly) '' mkdir -p $out/Library/Frameworks/ mv SystemConfiguration.fproj/SystemConfiguration.framework $out/Library/Frameworks ''; }