Skip to content

Bind-mount /run/opengl-driver/lib for CUDA/OpenGL support #32

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

Merged
merged 3 commits into from
Mar 12, 2021

Conversation

r-burns
Copy link
Contributor

@r-burns r-burns commented Feb 23, 2021

Fixes #31

This is implemented by allowing manual bind-mounts before the toplevel dirs are mounted. The bind mounting logic is now recursive, to allow for mounting siblings of any such previously mounted paths.

Currently, this functionality only exists to provide the user-owned /run/opengl-driver/lib bind mount alongside the host system's /run contents. However, it may be used for masking other paths in the future. For example, we could bind mount /nix/etc/nix/nix.conf to /etc/nix/nix.conf and do away with the need for the NIX_CONF_DIR override.

@Mic92
Copy link
Member

Mic92 commented Feb 23, 2021

Looks good. I try to test this soon but please ping me again in case I forget it.

* check files/links before mounting and ignore if the mountpoint already exists
* if the mountpoint of a directory exists and isn't a dir, we can't
  recurse and mount the subdir siblings
@r-burns
Copy link
Contributor Author

r-burns commented Feb 23, 2021

Must admit I'm not a big fan of the additional branchiness. Hopefully the value of the feature exceeds the cost of the added complexity.

@r-burns
Copy link
Contributor Author

r-burns commented Mar 11, 2021

Friendly ping :)

I've been using this for a while and haven't encountered any issues. Functionally I'm happy with it, but I'm not very experienced in Rust, so I'd appreciate any suggestions for making the code more idiomatic.

@Mic92 Mic92 merged commit eb20e66 into nix-community:master Mar 12, 2021
@Mic92
Copy link
Member

Mic92 commented Mar 12, 2021

Thanks! Tested in a container.

@Mic92
Copy link
Member

Mic92 commented Mar 12, 2021

Released in 1.2.0

@r-burns r-burns deleted the opengl-driver-link branch March 12, 2021 17:01
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.

Enhancement: mount /run/opengl-driver/lib for CUDA support
2 participants