Re:macOS Nix setup: an alternative to Homebrew (2020)
by WhyNotHugo on Thursday July 15, 2021 @10:41AM
(#27845313)
Flatpak and the xdg-desktop-portal have some pretty interesting ideas.
It's a huge shame there's almost zero documentation, both in the code, and for users / developers. I've heard about this feature before, but I've no idea how to make it work.
xdg-desktop-portal [1] does something pretty close, and it is how Linux applications shipped as Flatpaks access your files (at least when the Flatpak sandbox is in enforcing mode). Every sandboxed program has its own mount namespace which cannot see your home folder. When you want to open a file in a sandboxed program, you select the file in an out-of-process file chooser, and the portal puts a handle to that file in the program's view of the filesystem.
[1] https://github.com/flatpak/xdg-desktop-portal-gtk/