Skip to content

Conversation

terlar
Copy link
Contributor

@terlar terlar commented Jul 30, 2025

This broke with #417132 where the previous behaviour of suppressing errors of the export into $NIX_BUILD_TOP/env-vars when dumping env vars.

This error seems to stem from the non-existance of $NIX_BUILD_TOP. This fix ensures the NIX_BUILD_TOP propagates into the proot environment.

This can be verified by running the dockerTools tests:

nix build .#dockerTools.tests.docker-tools

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@terlar
Copy link
Contributor Author

terlar commented Jul 30, 2025

One alternative is to put noDumpEnvVars=1 before the sourcing of $stdenv/setup. Not sure that is appropriate though, since it is building and just happen to wrap the build inside proot.

This broke with NixOS#417132 where the previous behaviour of suppressing
errors of the export into $NIX_BUILD_TOP/env-vars when dumping env vars.

This error seems to stem from the non-existance of $NIX_BUILD_TOP. This
fix ensures the NIX_BUILD_TOP propagates into the proot environment.
@terlar terlar force-pushed the fix-docker-tools-with-fakechroot branch from 402731f to 6ccf14b Compare July 30, 2025 13:31
@nix-owners nix-owners bot requested a review from roberth July 30, 2025 14:07
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jul 31, 2025
@juliusrickert
Copy link
Member

Thank you very much for your efforts, @terlar.
I can confirm that this patch solves the build regressions I described on the PR to master.

I'm curious to know how you made out the PR/commit that introduced the regression. I tried throwing git bisect at the problem, but I didn't get to the source.

@philiptaron
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 429601 --package dockerTools.tests.docker-tools
Commit: 6ccf14ba235944f96f67e252812d59ef1fb15e38


x86_64-linux

✅ 1 package built:
  • dockerTools.tests.docker-tools

@philiptaron philiptaron merged commit 84c256e into NixOS:master Aug 25, 2025
41 of 48 checks passed
@terlar
Copy link
Contributor Author

terlar commented Aug 26, 2025

@juliusrickert The procedure was quite painful as it was changes in the generic-builder. I explained it here:
#417132 (comment)

I had to drill down to the code (customisationLayer) that was throwing the error, as otherwise I had to rebuild 1000s of packages.

builtins.elemAt (pkgs.dockerTools.streamLayeredImage {
  name = "debug-stream-layered-image";
  enableFakechroot = true;
  fakeRootCommands = ''
    echo Is it working?
  '';
}).conf.layersJsonFile.exclude_paths 1

Even with this I had to rebuild a few 100 packages, so it took a few hours to bisect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants