diff --git a/pkgs/by-name/aw/aws-sdk-cpp/package.nix b/pkgs/by-name/aw/aws-sdk-cpp/package.nix index d49d199b2203d..d17b9b16ae361 100644 --- a/pkgs/by-name/aw/aws-sdk-cpp/package.nix +++ b/pkgs/by-name/aw/aws-sdk-cpp/package.nix @@ -14,6 +14,8 @@ apis ? [ "*" ], # Whether to enable AWS' custom memory management. customMemoryManagement ? true, + # Builds in 2+h with 2 cores, and ~10m with a big-parallel builder. + requiredSystemFeatures ? [ "big-parallel" ], }: let @@ -116,8 +118,7 @@ stdenv.mkDerivation rec { __darwinAllowLocalNetworking = true; - # Builds in 2+h with 2 cores, and ~10m with a big-parallel builder. - requiredSystemFeatures = [ "big-parallel" ]; + inherit requiredSystemFeatures; passthru = { tests = { diff --git a/pkgs/by-name/bo/boehmgc/package.nix b/pkgs/by-name/bo/boehmgc/package.nix index 69bc48b1c852a..5755e462fad4f 100644 --- a/pkgs/by-name/bo/boehmgc/package.nix +++ b/pkgs/by-name/bo/boehmgc/package.nix @@ -3,10 +3,19 @@ stdenv, fetchFromGitHub, autoreconfHook, - # doc: https://github.com/ivmai/bdwgc/blob/v8.2.8/doc/README.macros (LARGE_CONFIG) + # doc: https://github.com/bdwgc/bdwgc/blob/v8.2.8/doc/README.macros (LARGE_CONFIG) enableLargeConfig ? false, enableMmap ? true, enableStatic ? false, + # Allows derivation users to increase the initial mark stack size to avoid stack overflows, + # since these inhibit parallel marking (see `GC_mark_some()` in `mark.c`.) + # + # Run Nix with the `GC_PRINT_STATS=1` environment set to check if the mark stack is too small. + # Look for messages such as `Mark stack overflow`, `No room to copy back mark stack`, and + # `Grew mark stack to ... frames`. + # + # If this parameter is set to `null`, the default from upstream is used, which is 4096 as of 8.2.8 + initialMarkStackSize ? null, nixVersions, }: @@ -15,7 +24,7 @@ stdenv.mkDerivation (finalAttrs: { version = "8.2.8"; src = fetchFromGitHub { - owner = "ivmai"; + owner = "bdwgc"; repo = "bdwgc"; rev = "v${finalAttrs.version}"; hash = "sha256-UQSLK/05uPal6/m+HMz0QwXVII1leonlmtSZsXjJ+/c="; @@ -40,18 +49,32 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optional enableMmap "--enable-mmap" ++ lib.optional enableLargeConfig "--enable-large-config"; - # This stanza can be dropped when a release fixes this issue: - # https://github.com/ivmai/bdwgc/issues/376 - # The version is checked with == instead of versionAtLeast so we - # don't forget to disable the fix (and if the next release does - # not fix the problem the test failure will be a reminder to - # extend the set of versions requiring the workaround). - makeFlags = lib.optionals (stdenv.hostPlatform.isPower64 && finalAttrs.version == "8.2.8") [ - # do not use /proc primitives to track dirty bits; see: - # https://github.com/ivmai/bdwgc/issues/479#issuecomment-1279687537 - # https://github.com/ivmai/bdwgc/blob/54522af853de28f45195044dadfd795c4e5942aa/include/private/gcconfig.h#L741 - "CFLAGS_EXTRA=-DNO_SOFT_VDB" - ]; + makeFlags = + let + defineFlag = flag: "-D${flag}"; + + # This stanza can be dropped when a release fixes this issue: + # https://github.com/bdwgc/bdwgc/issues/376 + # The version is checked with == instead of versionAtLeast so we + # don't forget to disable the fix (and if the next release does + # not fix the problem the test failure will be a reminder to + # extend the set of versions requiring the workaround). + noSoftVDB = lib.optional (stdenv.hostPlatform.isPower64 && finalAttrs.version == "8.2.8") ( + # do not use /proc primitives to track dirty bits; see: + # https://github.com/bdwgc/bdwgc/issues/479#issuecomment-1279687537 + # https://github.com/bdwgc/bdwgc/blob/54522af853de28f45195044dadfd795c4e5942aa/include/private/gcconfig.h#L741 + "NO_SOFT_VDB" + ); + + initialMarkStackSizeFlag = lib.optionals (initialMarkStackSize != null) [ + "INITIAL_MARK_STACK_SIZE=${toString initialMarkStackSize}" + ]; + + cflagsExtra = noSoftVDB ++ initialMarkStackSizeFlag; + in + lib.optionals (cflagsExtra != [ ]) [ + "CFLAGS_EXTRA=${lib.concatMapStringsSep " " defineFlag cflagsExtra}" + ]; # OpenBSD patches lld (!!!!) to inject this symbol into every linker invocation. # We are obviously not doing that. @@ -91,7 +114,7 @@ stdenv.mkDerivation (finalAttrs: { Alternatively, the garbage collector may be used as a leak detector for C or C++ programs, though that is not its primary goal. ''; - changelog = "https://github.com/ivmai/bdwgc/blob/v${finalAttrs.version}/ChangeLog"; + changelog = "https://github.com/bdwgc/bdwgc/blob/v${finalAttrs.version}/ChangeLog"; license = "https://hboehm.info/gc/license.txt"; # non-copyleft, X11-style license maintainers = with lib.maintainers; [ ]; platforms = lib.platforms.all; diff --git a/pkgs/tools/package-management/nix/dependencies.nix b/pkgs/tools/package-management/nix/dependencies.nix index 82f844f828874..ed5a63ce3ecfc 100644 --- a/pkgs/tools/package-management/nix/dependencies.nix +++ b/pkgs/tools/package-management/nix/dependencies.nix @@ -8,32 +8,31 @@ regular@{ { scopeFunction = scope: { - boehmgc = - (regular.boehmgc.override { - enableLargeConfig = true; - }).overrideAttrs - (attrs: { - # Increase the initial mark stack size to avoid stack - # overflows, since these inhibit parallel marking (see - # GC_mark_some()). To check whether the mark stack is too - # small, run Nix with GC_PRINT_STATS=1 and look for messages - # such as `Mark stack overflow`, `No room to copy back mark - # stack`, and `Grew mark stack to ... frames`. - NIX_CFLAGS_COMPILE = "-DINITIAL_MARK_STACK_SIZE=1048576"; - }); + boehmgc = regular.boehmgc.override { + enableLargeConfig = true; - aws-sdk-cpp = - (regular.aws-sdk-cpp.override { - apis = [ - "identity-management" - "s3" - "transfer" - ]; - customMemoryManagement = false; - }).overrideAttrs - { - # only a stripped down version is build which takes a lot less resources to build - requiredSystemFeatures = [ ]; - }; + # Increase the initial mark stack size to avoid stack overflows, since these inhibit parallel + # marking (see `GC_mark_some()` in `mark.c`). + # + # Run Nix with `GC_PRINT_STATS=1` set to see if the mark stack is too small. + # Look for messages such as `Mark stack overflow`, `No room to copy back mark stack`, and + # `Grew mark stack to ... frames`. + initialMarkStackSize = 1048576; + }; + + aws-sdk-cpp = regular.aws-sdk-cpp.override { + # Nix only needs these AWS APIs. + apis = [ + "identity-management" + "s3" + "transfer" + ]; + + # Don't use AWS' custom memory management. + customMemoryManagement = false; + + # only a stripped down version is built which takes a lot less resources to build + requiredSystemFeatures = [ ]; + }; }; }