darwin: add darwinMinVersionHook

Adding the hook allows the deployment target to be changed without
having to mess with the stdenv. The can also be propagated, which is
useful for libraries that have a minimum deployment target higher than
the default in nixpkgs. In that case, they can propagate the hook to
ensure library users are not targeting an unsupported version.

+38
+26
pkgs/os-specific/darwin/darwin-min-version-hook/setup-hook.sh
··· 1 + local role_post 2 + getHostRole 3 + 4 + # Compare the requested deployment target to the existing one. The deployment target has to be a version number, 5 + # and this hook tries to do the right thing with deployment targets set outside of it, so it has to parse 6 + # the version numbers for the comparison manually. 7 + 8 + local darwinMinVersion=@deploymentTarget@ 9 + local darwinMinVersionVar=@darwinMinVersionVariable@${role_post} 10 + 11 + local currentDeploymentTargetArr 12 + IFS=. read -a currentDeploymentTargetArr <<< "${!darwinMinVersionVar-0.0.0}" 13 + 14 + local darwinMinVersionArr 15 + IFS=. read -a darwinMinVersionArr <<< "$darwinMinVersion" 16 + 17 + local currentDeploymentTarget 18 + currentDeploymentTarget=$(printf "%02d%02d%02d" "${currentDeploymentTargetArr[0]-0}" "${currentDeploymentTargetArr[1]-0}" "${currentDeploymentTargetArr[2]-0}") 19 + 20 + darwinMinVersion=$(printf "%02d%02d%02d" "${darwinMinVersionArr[0]-0}" "${darwinMinVersionArr[1]-0}" "${darwinMinVersionArr[2]-0}") 21 + 22 + if [ "$darwinMinVersion" -gt "$currentDeploymentTarget" ]; then 23 + export "$darwinMinVersionVar"=@deploymentTarget@ 24 + fi 25 + 26 + unset -v role_post currentDeploymentTarget currentDeploymentTargetArr darwinMinVersion darwinMinVersionArr darwinMinVersionVar
+12
pkgs/top-level/all-packages.nix
··· 23740 23740 23741 23741 plumed = callPackage ../development/libraries/science/chemistry/plumed { }; 23742 23742 23743 + ### DEVELOPMENT / LIBRARIES / DARWIN SDKS 23744 + 23745 + darwinMinVersionHook = 23746 + deploymentTarget: 23747 + makeSetupHook { 23748 + name = "darwin-deployment-target-hook-${deploymentTarget}"; 23749 + substitutions = { 23750 + darwinMinVersionVariable = lib.escapeShellArg stdenv.hostPlatform.darwinMinVersionVariable; 23751 + deploymentTarget = lib.escapeShellArg deploymentTarget; 23752 + }; 23753 + } ../os-specific/darwin/darwin-min-version-hook/setup-hook.sh; 23754 + 23743 23755 ### DEVELOPMENT / LIBRARIES / AGDA 23744 23756 23745 23757 agdaPackages = callPackage ./agda-packages.nix {