Skip to content

Commit

Permalink
Merge pull request NixOS#9731 from obsidiansystems/better-test-no-gc
Browse files Browse the repository at this point in the history
Improve the build without GC
  • Loading branch information
Ericson2314 authored Jan 10, 2024
2 parents 84aa8e9 + 0c3ce23 commit 75d509e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@
buildCross = forAllCrossSystems (crossSystem:
lib.genAttrs ["x86_64-linux"] (system: self.packages.${system}."nix-${crossSystem}"));

buildNoGc = forAllSystems (system: self.packages.${system}.nix.overrideAttrs (a: { configureFlags = (a.configureFlags or []) ++ ["--enable-gc=no"];}));
buildNoGc = forAllSystems (system:
self.packages.${system}.nix.override { enableGC = false; }
);

buildNoTests = forAllSystems (system:
self.packages.${system}.nix.override {
Expand Down
12 changes: 10 additions & 2 deletions package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@
# Whether to build the regular manual
, enableManual ? __forDefaults.canRunInstalled

# Whether to use garbage collection for the Nix language evaluator.
#
# If it is disabled, we just leak memory, but this is not as bad as it
# sounds so long as evaluation just takes places within short-lived
# processes. (When the process exits, the memory is reclaimed; it is
# only leaked *within* the process.)
, enableGC ? true

# Whether to enable Markdown rendering in the Nix binary.
, enableMarkdown ? !stdenv.hostPlatform.isWindows

Expand Down Expand Up @@ -245,9 +253,8 @@ in {
;

propagatedBuildInputs = [
boehmgc
nlohmann_json
];
] ++ lib.optional enableGC boehmgc;

dontBuild = !attrs.doBuild;
doCheck = attrs.doCheck;
Expand Down Expand Up @@ -286,6 +293,7 @@ in {
(lib.enableFeature doInstallCheck "functional-tests")
(lib.enableFeature enableInternalAPIDocs "internal-api-docs")
(lib.enableFeature enableManual "doc-gen")
(lib.enableFeature enableGC "gc")
(lib.enableFeature enableMarkdown "markdown")
(lib.enableFeature installUnitTests "install-unit-tests")
(lib.withFeatureAs true "readline-flavor" readlineFlavor)
Expand Down

0 comments on commit 75d509e

Please sign in to comment.