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

A very restricted recursive nix socket in the sandbox #8602

Open
Tracked by #6316
roberth opened this issue Jun 29, 2023 · 1 comment
Open
Tracked by #6316

A very restricted recursive nix socket in the sandbox #8602

roberth opened this issue Jun 29, 2023 · 1 comment
Labels
feature Feature request or proposal recursive-nix The recursive-nix experimental feature sandbox How we isolate build impurities and protect the host settings Settings, global flags, nix.conf store Issues and pull requests concerning the Nix store tests UX The way in which users interact with Nix. Higher level than UI.

Comments

@roberth
Copy link
Member

roberth commented Jun 29, 2023

Is your feature request related to a problem? Please describe.

  • For RFC 92 dynamic derivations we want to add derivations to the store from within the sandbox. While writing a derivation text to a predefined location such as $out would get the job done for a single derivation, the real power comes from adding multiple derivations. After all, if you're going to produce only one derivation, you might as well "inline" the work - not that useful.
  • When running nix inside the nix sandbox, users have to perform a lot of nontrivial setup just to get instantiation to work (EDIT: this is also Make Nix configure itself better when it runs in the sandbox #8698, but I haven't removed this aspect from the issue because there's a strong interaction)

Describe the solution you'd like

  • A very restricted recursive nix socket in the sandbox, supporting addToStore and little else, if anything
  • An environment variable that's set in the sandbox configures nix with a default store that behaves correctly

If both solutions apply in all derivations, that would significantly improve the user experience for testing.

Describe alternatives you've considered

Without considering RFC 92, we could view as a goal: easier setup of a separate store in the sandbox. In other words, we could make this setup easier.

Additional context

Priorities

Add 👍 to issues you find important.

@roberth roberth added feature Feature request or proposal UX The way in which users interact with Nix. Higher level than UI. store Issues and pull requests concerning the Nix store sandbox How we isolate build impurities and protect the host settings Settings, global flags, nix.conf labels Jun 29, 2023
@roberth roberth added the tests label Jun 29, 2023
@roberth
Copy link
Member Author

roberth commented Aug 11, 2023

Which protocol

The protocol of this recursive nix socket will be part of the derivation interface which we intend to support indefinitely. That's rather significant. We might not want to expose the actual, current daemon protocol to the builder; certainly not all of it. Some of it will be effectively excluded because we deny those operations, but we probably don't want to carry over the legacy operations either.

Returning arbitrary outputs

If we create the derivation for RFC 92 using, say, nix-instantiate, how do we put whatever path that returns as the output of the build that produces the .drv? My first thought was to support symlinks, but @Ericson2314 mentions that this is a more general opportunity that applies to all ca derivations. Interestingly, we could even support returning an output early, so that, say, a dev output unblocks dependencies even before the binary is built. This would suggest making the completion of an output part of the protocol rather than waiting for a symlink to appear (which could potentially still be modified by the build, and requires polling, inotify or equivalent which isn't great).

@roberth roberth added the recursive-nix The recursive-nix experimental feature label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal recursive-nix The recursive-nix experimental feature sandbox How we isolate build impurities and protect the host settings Settings, global flags, nix.conf store Issues and pull requests concerning the Nix store tests UX The way in which users interact with Nix. Higher level than UI.
Projects
None yet
Development

No branches or pull requests

1 participant