Skip to content

importCargoLock: introduce alternative parameter lockFileContents#137395

Merged
danieldk merged 1 commit intoNixOS:masterfrom
dermetfan:cargo-lock-restricted
Sep 20, 2021
Merged

importCargoLock: introduce alternative parameter lockFileContents#137395
danieldk merged 1 commit intoNixOS:masterfrom
dermetfan:cargo-lock-restricted

Conversation

@dermetfan
Copy link
Copy Markdown
Member

Motivation for this change

In restricted mode (and therefore with flakes) builtins.readFile may not be the result of builtins.toFile,
making it impossible to use a generated lockFile (with or without IFD),
and thereby causing evaluation to fail if system != builtins.currentSystem on Hydra
so the jobs are not delegated to eligible build machines that support that system.

This is done in a way that avoids rebuilds.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. label Sep 11, 2021
@ofborg ofborg 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 Sep 11, 2021
@jonringer
Copy link
Copy Markdown
Contributor

cc @Mic92 @danieldk this looks pretty harmless.

diff LGTM to me

Copy link
Copy Markdown
Contributor

@danieldk danieldk left a comment

Choose a reason for hiding this comment

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

Looks good to me, but it would be nice if a test is added for this.

In restricted mode (and therefore with flakes) `builtins.readFile` may not be the result of `builtins.toFile`,
making it impossible to use a generated lockFile (with or without IFD),
and thereby causing evaluation to fail if `system != builtins.currentSystem` on Hydra
so the jobs are not delegated to eligible build machines that support that system.

This is done in a way that avoids rebuilds.
@dermetfan
Copy link
Copy Markdown
Member Author

Test added 🙂

@danieldk
Copy link
Copy Markdown
Contributor

@ofborg build tests.importCargoLock

Copy link
Copy Markdown
Contributor

@danieldk danieldk left a comment

Choose a reason for hiding this comment

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

Looks good to me! I don't want to hold up this PR any further, but could you make a follow-up PR that adds this option to the nixpkgs Rust docs?

@danieldk danieldk merged commit 24b5074 into NixOS:master Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 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