-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Why a bindfs rather than a symlink? #42
Comments
You mean for the home-manager module or for the NixOS module? I use the latter extensively and haven't had any similar issues, so I wonder why you're seeing these delayed mounts. #1 has a long discussion on improving our API to give users more control over how they want state exposed, but work on it has not yet begun. |
I mean the home-manager module, but I embed home-manager in the NixOS configuration by importing Maybe items under |
The reason for using I'm not really sure what problems you're having with the bind mounts. They should be started with your user session as systemd user services. Do you mean that they're not yet started when you've logged in? |
On Linux could regular binds be used instead? The performance hit from using fuse can be significant. For example the following is from within the directory at its bindfs mounted destination directory. dd if=/dev/zero of=./test.img count=10 bs=1G
10+0 records in
10+0 records out
10737418240 bytes (11 GB, 10 GiB) copied, 18.0036 s, 596 MB/s The following is performance in the source directory: dd if=/dev/zero of=./test.img count=10 bs=1G
10+0 records in
10+0 records out
10737418240 bytes (11 GB, 10 GiB) copied, 5.633 s, 1.9 GB/s It's about 4 times faster. |
With #44 in place, you could use the regular NixOS module to replace the home-manager one completely, if you want to get rid of |
Yes, bindfs is slow to copy/move between things that are really on the same FS as well. I still don't know why we couldn't just symlink instead of bindfs though - I understand why not regular bind mount. Should I use the NixOS one as you said in #42 (comment)? How would I adapt my config - #42 (comment) - to use the NixOS one instead? |
There were a few applications which didn't work with symlinks - GnuPG is the one I remember right now. There were also issues when you wanted to persist a directory and let home-manager handle some files in it, at least with the way the symlinking was implemented. bindfs should be more transparent to the applications, just like regular bind mounts are. Sure, it's possible to support both, if necessary. I wasn't aware of any applications which had issues with bindfs and haven't tried using the module with Steam. What errors are you getting? Going back to your original question, though, what do you mean with things not being mounted on login? The bind mounts are supposed to be set up early on login, before anything else starts in the session. Do they fail completely or do you mean some services start before them and can't access their files? When using the NixOS module instead of the home-manager one, you would have to specify the whole user folder path for all the files and directories, but otherwise, usage should be the same. Something like this: {
environment.persistence."/persistent/home/talyz" = {
directories = [
"/home/talyz/Downloads"
"/home/talyz/Music"
"/home/talyz/Pictures"
"/home/talyz/Documents"
"/home/talyz/.gnupg"
"/home/talyz.ssh"
];
files = [
"/home/talyz/.screenrc"
];
};
} |
When using NixOS module the bind mounts are created as the root user which creates problems on subsequent writes into those folders if say your mounting into |
I've implemented proper support for users in the NixOS module in #70. This includes solving the permissions issue you mentioned, @nigelgbanks. It also allows for setting default ownership and mode for created directories in general, which is useful for directories used for storing secrets. Help testing it would be appreciated. If it works well enough, I think we could deprecate the |
@talyz - That sounds really awesome! |
I had a bit of an odd use case that I've since abandoned in which my home directory was a |
You know, this isn't an odd use-case at all. In the rest of the world, it may sound odd. But this project was mainly created around this use-case 😉 |
Just wondered why we bother with bindfs rather than just using a symlink? Wouldn't a bindfs allow blocking until the persistent filesystem is mounted, and wouldn't it not have to wait until half way through the user's session start to be able to be used?
I'm just seeing a lot of things that aren't yet mounted on login even though I should see every mount first, e.g. desktop settings, wifi password keychains etc
The text was updated successfully, but these errors were encountered: