{ config, lib, pkgs, vars, ... }: let # `x-systemd.automount` never works inside a Linux container (LXC # included, regardless of privilege) -- confirmed live on lxc-docker: # systemd logs "Starting of .automount unsupported" for every # share and never mounts them. Mount eagerly there instead, with # `nofail` so a boot with the NFS server unreachable doesn't hang # (the VM platforms rely on automount itself to get that same # non-blocking behavior, so they don't need `nofail` too). automountOpts = if config.boot.isContainer then [ "nofail" ] else [ "x-systemd.automount" ]; in { fileSystems = { ${vars.nfsShares.dockerConfig.mountpoint} = { device = "${vars.nfsServerHost}:${vars.storageRoot}/${vars.nfsShares.dockerConfig.subpath}"; fsType = "nfs"; options = [ "nfsvers=4.2" "_netdev" "noatime" ] ++ automountOpts; }; ${vars.nfsShares.dockerDatabases.mountpoint} = { device = "${vars.nfsServerHost}:${vars.storageRoot}/${vars.nfsShares.dockerDatabases.subpath}"; fsType = "nfs"; options = [ "nfsvers=4.2" "_netdev" "noatime" ] ++ automountOpts; }; ${vars.nfsShares.dockerVolumes.mountpoint} = { device = "${vars.nfsServerHost}:${vars.storageRoot}/${vars.nfsShares.dockerVolumes.subpath}"; fsType = "nfs"; options = [ "nfsvers=4.2" "_netdev" "noatime" ] ++ automountOpts; }; ${vars.nfsShares.nextcloudData.mountpoint} = { device = "${vars.nfsServerHost}:${vars.storageRoot}/${vars.nfsShares.nextcloudData.subpath}"; fsType = "nfs"; options = [ "nfsvers=4.2" "_netdev" "noatime" ] ++ automountOpts; }; ${vars.nfsShares.raspiVolumes.mountpoint} = { device = "${vars.nfsServerHost}:${vars.storageRoot}/${vars.nfsShares.raspiVolumes.subpath}"; fsType = "nfs"; options = [ "nfsvers=4.2" "_netdev" "noatime" ] ++ automountOpts; }; }; }