mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
This reduces the closure size on master by 40MiB. ``` $ nix build github:nixos/nix/1e822bd4149a8bce1da81ee2ad9404986b07914c#nix-store --out-link closure-on-master $ nix build .#nix-store -L --out-link closure-without-icu $ nix path-info --closure-size -h ./closure-on-master /nix/store/8gwr38m5h6p7245ji9jv28a2a11w1isx-nix-store-2.29.0pre 124.4 MiB $ nix path-info --closure-size -h ./closure-without-icu /nix/store/k0gwfykjqpnmaqbwh23nk55lhanc9g24-nix-store-2.29.0pre 86.6 MiB ```
107 lines
3.2 KiB
Nix
107 lines
3.2 KiB
Nix
# These overrides are applied to the dependencies of the Nix components.
|
|
|
|
{
|
|
# Flake inputs; used for sources
|
|
inputs,
|
|
|
|
# The raw Nixpkgs, not affected by this scope
|
|
pkgs,
|
|
|
|
stdenv,
|
|
}:
|
|
|
|
let
|
|
prevStdenv = stdenv;
|
|
in
|
|
|
|
let
|
|
inherit (pkgs) lib;
|
|
|
|
stdenv = if prevStdenv.isDarwin && prevStdenv.isx86_64 then darwinStdenv else prevStdenv;
|
|
|
|
# Fix the following error with the default x86_64-darwin SDK:
|
|
#
|
|
# error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer
|
|
#
|
|
# Despite the use of the 10.13 deployment target here, the aligned
|
|
# allocation function Clang uses with this setting actually works
|
|
# all the way back to 10.6.
|
|
# NOTE: this is not just a version constraint, but a request to make Darwin
|
|
# provide this version level of support. Removing this minimum version
|
|
# request will regress the above error.
|
|
darwinStdenv = pkgs.overrideSDK prevStdenv { darwinMinVersion = "10.13"; };
|
|
|
|
in
|
|
scope: {
|
|
inherit stdenv;
|
|
|
|
aws-sdk-cpp =
|
|
(pkgs.aws-sdk-cpp.override {
|
|
apis = [
|
|
"identity-management"
|
|
"s3"
|
|
"transfer"
|
|
];
|
|
customMemoryManagement = false;
|
|
}).overrideAttrs
|
|
{
|
|
# only a stripped down version is built, which takes a lot less resources
|
|
# to build, so we don't need a "big-parallel" machine.
|
|
requiredSystemFeatures = [ ];
|
|
};
|
|
|
|
boehmgc = pkgs.boehmgc.override {
|
|
enableLargeConfig = true;
|
|
};
|
|
|
|
# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
|
|
boost =
|
|
(pkgs.boost.override {
|
|
extraB2Args = [
|
|
"--with-container"
|
|
"--with-context"
|
|
"--with-coroutine"
|
|
"--with-iostreams"
|
|
];
|
|
enableIcu = false;
|
|
}).overrideAttrs
|
|
(old: {
|
|
# Need to remove `--with-*` to use `--with-libraries=...`
|
|
buildPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.buildPhase;
|
|
installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase;
|
|
});
|
|
|
|
libgit2 =
|
|
if lib.versionAtLeast pkgs.libgit2.version "1.9.0" then
|
|
pkgs.libgit2
|
|
else
|
|
pkgs.libgit2.overrideAttrs (attrs: {
|
|
# libgit2: Nixpkgs 24.11 has < 1.9.0, which needs our patches
|
|
nativeBuildInputs =
|
|
attrs.nativeBuildInputs or [ ]
|
|
# gitMinimal does not build on Windows. See packbuilder patch.
|
|
++ lib.optionals (!stdenv.hostPlatform.isWindows) [
|
|
# Needed for `git apply`; see `prePatch`
|
|
pkgs.buildPackages.gitMinimal
|
|
];
|
|
# Only `git apply` can handle git binary patches
|
|
prePatch =
|
|
attrs.prePatch or ""
|
|
+ lib.optionalString (!stdenv.hostPlatform.isWindows) ''
|
|
patch() {
|
|
git apply
|
|
}
|
|
'';
|
|
patches =
|
|
attrs.patches or [ ]
|
|
++ [
|
|
./patches/libgit2-mempack-thin-packfile.patch
|
|
]
|
|
# gitMinimal does not build on Windows, but fortunately this patch only
|
|
# impacts interruptibility
|
|
++ lib.optionals (!stdenv.hostPlatform.isWindows) [
|
|
# binary patch; see `prePatch`
|
|
./patches/libgit2-packbuilder-callback-interruptible.patch
|
|
];
|
|
});
|
|
}
|