Mergerfs with nix store

Hi,

I have seen a post on stack overflow asking about how to combine multiple drives for the nix store, and one of the suggestions in the comments was to use mergerfs, and I liked that idea, but I don’t know what’s the way to do it properly. do I need to change the store location to something like /storage where the drives are combined then somehow point to it in my nixos config? or can I just combine the /nix/store with something else and make it somehow store it in /nix/store

what I tried to do:

fileSystems."/nix/store" = {
  fsType·=·"fuse.mergerfs";
  device·=·"/media/extra/nix-store:/nix/store";
  options·=·["cache.files=partial"·"dropcacheonclose=true"·"category.create=mfs"\];
};

but that didn’t work, I’m guessing it doesn’t make sense that mergerfs would merge /nix/store into itself, so that’s fair

but what if I want to do this:

fileSystems."/storage" = {
  fsType·=·"fuse.mergerfs";
  device·=·"/media/extra/nix-store:/nix/store";
  options·=·["cache.files=partial"·"dropcacheonclose=true"·"category.create=mfs"\];
};

how do I point the nix store to /storage on my whole system?

or what’s the proper way to do this using mergerfs?

UPDATE:
so I just reformatted my machine and restorted it completely (thank god for nixos config files), and I’m now trying out ZFS by following the basic setup in the ZFS wiki page. so now I probably can just add more drives to the pool to get more storage space

1 Like