sheenobu dot net

2021-04-03 - NixOS - Gnome Bind Mount Hack

There are some nice features in Gnome related to filesystem mounts. Plug something in -> get an item in the Nautilus window.

However, this conflicts with fstab or systemd managed mounts. But I realized you could use bind mounts to accomplish the same thing. This is for NixOS but the technique should be distro-agnostic.

The outstanding questions are: How do you do this for every user? A user-level systemd mount that bind mounts to /run/media when you login? What does "ejecting" from the UI do? Does this expose any security issues with the root-managed /my-fs?

fileSystems."/my-fs" =
{ device = "/dev/disk/by-uuid/my-uuid";
  fsType = "xfs";
  neededForBoot = false;

fileSystems."/run/media/my-user/my-uuid" =
{ device = "/my-fs";
  fsType = "none";
  options = [ "bind" ];
  neededForBoot = false;
← Back to /snippets