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

Embed the sandbox shell into the statically linked 'nix' binary #6710

Merged
merged 1 commit into from
Jun 23, 2022

Conversation

edolstra
Copy link
Member

With this, Nix will write a copy of the sandbox shell to /bin/sh in the sandbox rather than bind-mounting it from the host filesystem. This makes /bin/sh work out of the box with nix-static, i.e. you no longer get

/nix/store/qa36xhc5gpf42l3z1a8m1lysi40l9p7s-bootstrap-stage4-stdenv-linux/setup: ./configure: /bin/sh: bad interpreter: No such file or directory

This increases the size of the nix binary by 213 KiB.

@edolstra edolstra force-pushed the embedded-sandbox-shell branch 2 times, most recently from b4c41c1 to 5259b31 Compare June 23, 2022 00:46
With this, Nix will write a copy of the sandbox shell to /bin/sh in
the sandbox rather than bind-mounting it from the host filesystem.
This makes /bin/sh work out of the box with nix-static, i.e. you no
longer get

  /nix/store/qa36xhc5gpf42l3z1a8m1lysi40l9p7s-bootstrap-stage4-stdenv-linux/setup: ./configure: /bin/sh: bad interpreter: No such file or directory
@edolstra edolstra force-pushed the embedded-sandbox-shell branch from 5259b31 to 925b975 Compare June 23, 2022 02:13
$(d)/build/local-derivation-goal.cc: $(d)/embedded-sandbox-shell.gen.hh

$(d)/embedded-sandbox-shell.gen.hh: $(sandbox_shell)
$(trace-gen) hexdump -v -e '1/1 "0x%x," "\n"' < $< > [email protected]
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure it's available in stdenv, but if it is, xxd has a --include option to directly produce a C-compatible header

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, xxd is part of vim which is a pretty big dependency to pull in...

Copy link
Member

Choose a reason for hiding this comment

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

Uh indeed, didn't know that 😲

@edolstra edolstra merged commit 3c57db1 into NixOS:master Jun 23, 2022
@edolstra edolstra deleted the embedded-sandbox-shell branch June 23, 2022 13:34
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-33/20048/1

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.

None yet

3 participants