8

I'm trying to declare a bind mount in my NixOS configuration. I'm trying the configuration snippet below, but it sends the OS into recovery mode when I test it out (using nixos-rebuild test). To be clear, I'd like /data to be reachable at /srv/nfs as well.

# 
# /etc/nixos/configuration.nix
#
fileSystems."/data" = {
  device = "/dev/disk/by-uuid/bobloblaw";
  fsType = "btrfs";
};

fileSystems."/srv/nfs" = {
  device = "/data";
  fsType = "bindfs";
};

Any advice?

1 Answer 1

9

Of course, right after posting this question I find this NixOS wiki article about NFS and bind mount examples:

https://nixos.wiki/wiki/NFS

TL;DR: Instead of fsType, I should have used options. At the time of writing this, the wiki is slightly out of date; options must be a list of strings.

This code snippet seems to work as expected:

# 
# /etc/nixos/configuration.nix
#
fileSystems."/data" = {
  device = "/dev/disk/by-uuid/bobloblaw";
  fsType = "btrfs";
};

fileSystems."/srv/nfs" = {
  device = "/data";
  options = [ "bind" ];
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.