Skip to content
5 changes: 4 additions & 1 deletion nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,10 @@ in
nix-config = runTest ./nix-config.nix;
nix-ld = runTest ./nix-ld.nix;
nix-misc = handleTest ./nix/misc.nix { };
nix-upgrade = handleTest ./nix/upgrade.nix { inherit (pkgs) nixVersions; };
nix-upgrade = handleTest ./nix/upgrade.nix {
inherit (pkgs) nixVersions;
inherit system;
};
nix-required-mounts = runTest ./nix-required-mounts;
nix-serve = runTest ./nix-serve.nix;
nix-serve-ssh = runTest ./nix-serve-ssh.nix;
Expand Down
13 changes: 9 additions & 4 deletions nixos/tests/nix/upgrade.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{ pkgs, nixVersions, ... }:
{
pkgs,
nixVersions,
system,
...
}:
let
lib = pkgs.lib;

fallback-paths-external = pkgs.writeTextDir "fallback-paths.nix" ''
{
${pkgs.system} = "${nixVersions.latest}";
${system} = "${nixVersions.latest}";
}'';

nixos-module = builtins.toFile "nixos-module.nix" ''
Expand Down Expand Up @@ -71,7 +76,7 @@ pkgs.testers.nixosTest {
if not match: raise Exception("Couldn't find new version in output: " + result)

with subtest("nix-build-with-mismatch-daemon"):
machine.succeed("runuser -u alice -- nix build --expr 'derivation {name =\"test\"; system = \"${pkgs.system}\";builder = \"/bin/sh\"; args = [\"-c\" \"echo test > $out\"];}' --print-out-paths")
machine.succeed("runuser -u alice -- nix build --expr 'derivation {name =\"test\"; system = \"${system}\";builder = \"/bin/sh\"; args = [\"-c\" \"echo test > $out\"];}' --print-out-paths")


with subtest("remove-new-nix"):
Expand All @@ -94,7 +99,7 @@ pkgs.testers.nixosTest {
if not match: raise Exception("Couldn't find new version in output: " + result)

with subtest("nix-build-with-new-daemon"):
machine.succeed("runuser -u alice -- nix build --expr 'derivation {name =\"test-new\"; system = \"${pkgs.system}\";builder = \"/bin/sh\"; args = [\"-c\" \"echo test > $out\"];}' --print-out-paths")
machine.succeed("runuser -u alice -- nix build --expr 'derivation {name =\"test-new\"; system = \"${system}\";builder = \"/bin/sh\"; args = [\"-c\" \"echo test > $out\"];}' --print-out-paths")

with subtest("nix-collect-garbage-with-old-nix"):
machine.succeed("${nixVersions.stable}/bin/nix-collect-garbage")
Expand Down
18 changes: 12 additions & 6 deletions pkgs/by-name/bm/bmake/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,18 @@ stdenv.mkDerivation (finalAttrs: {
# * opt-keep-going-indirect: not yet known
# * varmod-localtime: musl doesn't support TZDIR and this test relies on
# impure, implicit paths
env.BROKEN_TESTS = builtins.concatStringsSep " " [
"directive-export"
"directive-export-gmake"
"opt-keep-going-indirect"
"varmod-localtime"
];
# * interrupt-compat (fails on x86_64-linux building for i686-linux)
env.BROKEN_TESTS = lib.concatStringsSep " " (
[
"directive-export"
"directive-export-gmake"
"opt-keep-going-indirect"
"varmod-localtime"
]
++ lib.optionals stdenv.targetPlatform.is32bit [
"interrupt-compat"
]
);

strictDeps = true;

Expand Down
14 changes: 14 additions & 0 deletions pkgs/tools/package-management/nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,20 @@ lib.makeExtensible (

nix_2_30 = addTests "nix_2_30" self.nixComponents_2_30.nix-everything;

nixComponents_2_31 = nixDependencies.callPackage ./modular/packages.nix rec {
version = "2.31.0";
inherit (self.nix_2_30.meta) maintainers teams;
otherSplices = generateSplicesForNixComponents "nixComponents_2_31";
src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
tag = version;
hash = "sha256-5JYyijH2q/uQCDIZCCyQEBsZ0VPNP2SS1wgZ4+qeIWM=";
};
};

nix_2_31 = addTests "nix_2_31" self.nixComponents_2_31.nix-everything;

nixComponents_git = nixDependencies.callPackage ./modular/packages.nix rec {
version = "2.31pre20250712_${lib.substring 0 8 src.rev}";
inherit maintainers teams;
Expand Down
15 changes: 14 additions & 1 deletion pkgs/tools/package-management/nix/dependencies.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ regular@{

{
scopeFunction = scope: {
boehmgc = regular.boehmgc.override { enableLargeConfig = true; };
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";
Comment thread
philiptaron marked this conversation as resolved.
Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is breaking anyone who sets env.NIX_CFLAGS_COMPILE globally. Previously there were efforts to ensure we only use env.NIX_CFLAGS_COMPILE and not the attrs.NIX_CFLAGS_COMPILE (see #217206).

Is there any reason this needs to be directly in attrs or was this just a small oversight and we can move to using env?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that was an oversight.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cherry-picked the upstream commit but I agree that we should not use overrideAttrs (and ideally not use overrides) here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick response! I don't have time at the moment to create a PR, but will do so tonight (just to use env. for now, not avoiding overrideAttrs overall) if no one else gets to it first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm, it was such a quick fix I just made the PR now: #439910

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

});

aws-sdk-cpp =
(regular.aws-sdk-cpp.override {
apis = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
buildPackages,
stdenv,
mkMesonExecutable,
writableTmpDirAsHomeHook,

nix-fetchers,
nix-fetchers-c,
Expand Down Expand Up @@ -47,18 +48,13 @@ mkMesonExecutable (finalAttrs: {
runCommand "${finalAttrs.pname}-run"
{
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
buildInputs = [ writableTmpDirAsHomeHook ];
}
(
lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
);
''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
'';
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
buildPackages,
stdenv,
mkMesonExecutable,
writableTmpDirAsHomeHook,

nix-flake,
nix-flake-c,
Expand Down Expand Up @@ -41,19 +42,14 @@ mkMesonExecutable (finalAttrs: {
runCommand "${finalAttrs.pname}-run"
{
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
buildInputs = [ writableTmpDirAsHomeHook ];
}
(
lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
export NIX_CONFIG="extra-experimental-features = flakes"
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
);
(''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
export NIX_CONFIG="extra-experimental-features = flakes"
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
'');
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
buildPackages,
stdenv,
mkMesonExecutable,
writableTmpDirAsHomeHook,

nix-store,
nix-store-c,
Expand Down Expand Up @@ -41,6 +42,10 @@ mkMesonExecutable (finalAttrs: {
mesonFlags = [
];

excludedTestPatterns = lib.optionals (lib.versionOlder finalAttrs.version "2.31") [
"nix_api_util_context.nix_store_real_path_binary_cache"
];

passthru = {
tests = {
run =
Expand All @@ -58,18 +63,15 @@ mkMesonExecutable (finalAttrs: {
runCommand "${finalAttrs.pname}-run"
{
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
buildInputs = [ writableTmpDirAsHomeHook ];
}
(
lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"}
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
);
(''
export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"}
export NIX_REMOTE=$HOME/store
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage} \
--gtest_filter=-${lib.concatStringsSep ":" finalAttrs.excludedTestPatterns}
touch $out
'');
};
};

Expand Down
Loading