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

nixos-build-vm: Remove Nixpkgs path dependency #372492

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Jan 9, 2025

4ce241c switched substituteAll for replaceVars.
The latter stringifies the replacements, which leads to Nixpkgs filesystem path being embedded in the output.
This is disallowed by nixpkgs-basic-release-checks.nix.
#371501 (comment)

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

4ce241c switched `substituteAll` for `replaceVars`.
The latter stringifies the replacements, which leads to Nixpkgs filesystem path being embedded in the output.
This is disallowed by nixpkgs-basic-release-checks.nix.
NixOS#371501 (comment)
Comment on lines 11 to 14
replacements = {
inherit runtimeShell;
buildVms = ./build-vms.nix;
buildVms = "${./build-vms.nix}";
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder whether we should fix replaceVars to do that automatically?

@philiptaron

Copy link
Member Author

Choose a reason for hiding this comment

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

I am split on that, hence just the quick workaround. Especially when it did not look like any other replacement in your PR used paths.

It might be useful to have real file system paths sometimes. Though, I guess one can always use toString in the caller, and derivation does copy paths passed to it to the store, so it might be better to do the same for consistency.

Copy link
Contributor

@wolfgangwalther wolfgangwalther Jan 10, 2025

Choose a reason for hiding this comment

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

Especially when it did not look like any other replacement in your PR used paths.

Yes, but I have a few 100 more replacements coming up eventually - the goal is to replace substituteAll entirely. So there might be more paths coming up.

Copy link
Contributor

Choose a reason for hiding this comment

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

I originally did toString on the inputs to replaceVars that and was counseled against in in the original replaceVars PR. I'm fine with this quick workaround; let's see if there are other instances like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

A quick grep only came up with one other potential candidate:

(substituteAll {
src = ./setup-hook.sh;
# jdk used for keytool
inherit (gradle) jdk;
init_script = ./init-build.gradle;

@wolfgangwalther wolfgangwalther merged commit 3ad0b42 into NixOS:staging-next Jan 10, 2025
23 of 27 checks passed
@jtojnar jtojnar deleted the nixos-build-vm-path-dep branch January 10, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants