-
-
Notifications
You must be signed in to change notification settings - Fork 25
Functionality for additional control over the chroot's mounts #75
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
base: master
Are you sure you want to change the base?
Conversation
@DavHau what is your opinion on this, since you already maintain https://github.com/DavHau/nix-portable @rrbutani the functionality that you are describing make sense to have but I feel like it's turning a bit into what bubblewrap already provide to us. However I also see that value in just having one binary that is easy to install. So I am a bit unsure. |
So I thought about this a bit longer and I feel that simply exposing these mounts to users would make the tool harder to use because they generally would not know what to fill in for That's why I see two options here:
|
@Mic92 Thanks for the quick response.
For the exact issue in #74 I think this is very doable; adding in an However, there are also other reasons why I wanted this kind of functionality. On the servers I use Use cases like these hard to anticipate and harder still to settle on good one-size-fits-all behavior for. However, I think it's perfectly reasonable to say that such use cases are out of scope for
I am very much willing to implement this but I'm confused what something like this would look like in practice. Would the I think I get the appeal of doing something like this but I'm struggling to conceive of an implementation where the first step isn't adding some kind of config file like thing to this project. Edit: sorry, I think I maybe misunderstood; are you just saying that the defaults would be encoded in the |
Yes there could be a configuration format that is easy to generate by home-manager. I just don't know how one would bootstrap nix-user-chroot in this case. |
Hmm. It seems like the obvious way would be to have users manually grab But I get that this is not exactly optimal. The other setup I can think of is one where This'd let users skip a few steps but it also seems complicated and kind of ties us to |
In any case, in general is this a path you feel comfortable taking for If so, I think it might make sense to start by nailing down what the configuration file format should look like and what the defaults should be. |
I sent you an invite to nix-community and nix-user-chroot. I think as a first step we can have the more manual route and than later converge to auto install nix + home-manager. |
From a nix perspective probably json would work best but is than less editable by users... |
I think we are both on the same page regarding the project. I would give you a free hand about the details. Let me know when you want to have a code review. |
Thanks!
Oh hmm, good point. There isn't a I'm happy to switch to or add a JSON config file format thing – it's just using
I think this makes perfect sense! I can't think of any settings we'd need to bootstrap; keeping the current defaults (except maybe moving the thing about mounting in
Thank you, this is much appreciated. I think the PR is ready for review now; I stared at the path resolving logic a bit more and, while it's definitely not pretty and it still feels like there's a more elegant way to do it, I think it handles the cases it claims to. I think it still could use some tests though; I'll work on adding some, hopefully in the next few days. |
@Mic92, I'm in a similar situation like you, where I do not really need nix-portable myself. Maintenance is done purely according to feedback from the community. What benefits does nix-user-chroot provide over a static bubblewrap binary? If nix-user-chroot has benefits over just using bubblewrap with the right parameters, then I should probably add nix-user-chroot as a possible backend for nix-portable. If it doesn't, then the question arises why nix-user-chroot should be maintained any longer. |
@DavHau I hadn't taken a serious look at In general I think However, to me,
I think on However, with this PR This PR also adds a way for users to map in paths from their nix profile into the chroot which isn't functionality
Unless Personally I think there's enough of a difference in the use cases to warrant But I also think the distinction I'm trying to make is genuinely very narrow. I'm not sure there are other users that are looking to effectively run all their shell sessions inside a chroot with a |
… have permissions for
As described in #74, this PR adds functionality to
nix-user-chroot
that allows for:/
to/mount/extra-filesystem-root
)/bin/bash
from the user's nix-profile to/bin/bash
<path to nix dir>/var/nix/profiles/per-user/$USER/profile
/var/run
into the chrootCurrently, the config file is read from
<path to nix dir>/etc/nix-user-chroot/path-config.toml
. Here's an example of the format:#74 details some of the motivating use cases (overriding
/etc/group
, not mounting in socket files for daemons running outside the chroot, etc.).This PR isn't quite ready for merge yet. I think the path resolution logic for nix profile relative paths is pretty questionable and should be reviewed,
run_chroot
should be split up a bit, and some tests (particularly for nix profile relative symlink resolution) would be good to have too.I'm opening this PR as is anyways to solicit feedback and to get a feel for whether this is the right direction for this kind of feature/something that
nix-user-chroot
would be interested in adding.If this is deemed out of scope for this project, please feel free to close this PR.