Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocalDerivationGoal: set NIX_ATTRS_*_FILE correctly for sandboxed builds #8053

Merged

Conversation

lheckemann
Copy link
Member

Motivation

NIX_ATTRS_JSON_FILE was set to the out-of-sandbox path even in sandboxed builds.

Context

Checklist for maintainers

Maintainers: tick if completed or explain if not relevant

  • agreed on idea
  • agreed on implementation strategy
  • tests, as appropriate
    • functional tests - tests/**.sh
    • unit tests - src/*/tests
    • integration tests - tests/nixos/*
  • documentation in the manual
  • code and comments are self-explanatory
  • commit message explains why the change was made
  • new feature or incompatible change: updated release notes

Priorities

Add 👍 to pull requests you find important.

@lheckemann lheckemann requested a review from thufschmitt as a code owner March 16, 2023 14:22
@@ -1154,10 +1154,10 @@ void LocalDerivationGoal::writeStructuredAttrs()

writeFile(tmpDir + "/.attrs.sh", rewriteStrings(jsonSh, inputRewrites));
chownToBuilder(tmpDir + "/.attrs.sh");
env["NIX_ATTRS_SH_FILE"] = tmpDir + "/.attrs.sh";
env["NIX_ATTRS_SH_FILE"] = env["NIX_BUILD_TOP"] + "/.attrs.sh";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
env["NIX_ATTRS_SH_FILE"] = env["NIX_BUILD_TOP"] + "/.attrs.sh";
env["NIX_ATTRS_SH_FILE"] = tmpDirInSandbox + "/.attrs.sh";

writeFile(tmpDir + "/.attrs.json", rewriteStrings(json.dump(), inputRewrites));
chownToBuilder(tmpDir + "/.attrs.json");
env["NIX_ATTRS_JSON_FILE"] = tmpDir + "/.attrs.json";
env["NIX_ATTRS_JSON_FILE"] = env["NIX_BUILD_TOP"] + "/.attrs.json";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
env["NIX_ATTRS_JSON_FILE"] = env["NIX_BUILD_TOP"] + "/.attrs.json";
env["NIX_ATTRS_JSON_FILE"] = tmpDirInSandbox + "/.attrs.json";

@lheckemann lheckemann force-pushed the fix-structuredattrs-sandbox branch from bf7e34e to af4cbda Compare March 16, 2023 14:26
@edolstra edolstra enabled auto-merge March 16, 2023 14:27
@grahamc
Copy link
Member

grahamc commented Mar 16, 2023

It'd be great to get a test in place for this behavior, too.

@github-actions
Copy link

@github-actions
Copy link

@Artturin
Copy link
Member

Artturin commented Mar 16, 2023

This fixes #6736

It'd be great to get a test in place for this behavior, too.

#7778

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants