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

make-closure: needs build system mkdir and jq #42794

Merged
merged 1 commit into from Nov 13, 2018

Conversation

telent
Copy link
Contributor

@telent telent commented Jun 29, 2018

Make make-closure work when cross-compiling

Motivation for this change

Without it, anything that calls make-closure (e.g. squashfs generation) when cross-compiling dies because it tries to run a mkdir command built for the host system not the build system

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Make make-closure work when cross-compiling
@@ -4,7 +4,7 @@
# "nix-store --load-db" and "nix-store --register-validity
# --hash-given".

{ stdenv, coreutils, jq }:
{ stdenv, coreutils, jq, buildPackages }:
Copy link
Member

Choose a reason for hiding this comment

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

The coreutils and jq arguments aren't needed here anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I had had that thought. I wondered though if I've fixed it in the wrong place and there should be something in the way that make-closure is invoked/included/called by its callers which would cause it to use the build-system versions of coreutils and jq without my having to indirect explicitly through buildPackages. Maybe @Ericson2314 or @dtzWill would know?

Copy link
Member

Choose a reason for hiding this comment

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

If we were to do

nativeBuildInputs = [ jq, coreutils];

it would indeed happen automatically, due to the very magical and aweful "callPackage + mkDerivation splicing" we do. Without that, however, one needs use pick buildPackages by hand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It sounds like it would be better to stick with referring through buildPackages, but maybe that's my very low tolerance for magic? I'll remove the arguments that we don't need

@infinisil
Copy link
Member

Can you verify that the OVA still works in VirtualBox? It's built with nix-build nixos/release-combined.nix -A nixos.ova. Also, you checked the Tested via one or more NixOS test(s) box, but I don't see any relevant test?

@telent
Copy link
Contributor Author

telent commented Jul 4, 2018

Can you verify that the OVA still works in VirtualBox? It's built with nix-build nixos/release-combined.nix -A nixos.ova

It builds and boots into Plasma. I assume that's what it's supposed to do

Also, you checked the Tested via one or more NixOS test(s) box, but I don't see any relevant test?

I didn't intend to check any of them, because I haven't tested via any nixos tests, and i can't see any of them are checked - maybe some kind of browser weirdness?

Copy link
Member

@matthewbauer matthewbauer left a comment

Choose a reason for hiding this comment

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

I think using nativeBuildInputs makes the most since here. PATH should not be set directly.

@matthewbauer matthewbauer merged commit 4b8c1d2 into NixOS:master Nov 13, 2018
@matthewbauer
Copy link
Member

matthewbauer commented Nov 13, 2018

Nevermind - the builder used here makes it not work.

@Ericson2314
Copy link
Member

Shouldn't we still switch to nativeBuildInputs?

@matthewbauer
Copy link
Member

If you can figure out how to get rid of the "builder" here. Right now, it doesn't run the hooks to add nativeBuildInputs to PATH.

@Ericson2314
Copy link
Member

Ericson2314 commented Nov 13, 2018

Oh and structured attrs to. Yeah nevermind; this is quite incompatible with stdenv for now.

@telent telent deleted the make-closure-x branch October 29, 2021 10:27
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.

None yet

5 participants