zfs: hide mountpoints from gvfs
authorJulien Moutinho <julm+julm-nix@sourcephile.fr>
Tue, 5 Dec 2023 00:15:33 +0000 (01:15 +0100)
committerJulien Moutinho <julm+julm-nix@sourcephile.fr>
Tue, 5 Dec 2023 00:15:33 +0000 (01:15 +0100)
nixos/profiles/zfs.nix

index e5b4db7c7d15b401037a0b7f469b91adc1fe0eaf..87e7abfc06cfe839bbeac4356ab63736e259344f 100644 (file)
@@ -19,6 +19,7 @@
   # Stable enough, clearer, and faster than the default /dev/disk/by-id
   boot.zfs.devNodes = "/dev/disk/by-partlabel";
   # Not useful so far.
+  # See also https://github.com/NixOS/nixpkgs/issues/62644#issuecomment-1479523469
   boot.zfs.forceImportAll = false;
   # More resilient for remote hosts,
   # though it may call zpool clear.
   services.zfs.trim.enable = true;
   services.zfs.trim.interval = "Sun *-*-01..07 00:15:00";
 
+  # Hide ZFS mountpoints from gio, hence nautilus or caja
+  systemd.services.zfs-mount.postStart = ''
+    /run/wrappers/bin/mount -t zfs | cut -f 1 -d ' ' |
+    xargs -n 1 -r -t /run/wrappers/bin/mount -o remount,x-gvfs-hide
+  '';
+
   environment.systemPackages = [
     pkgs.lzop # For remote syncoid
     pkgs.mbuffer # For remote syncoid