Systemd.user.mounts is having no effect

Using home-manager, I am trying to achieve the same result as running the mount command:

sudo mount -o bind --source /home/dob/nextcloud/syncDir --target /home/dob/syncDir

In home.nix I have defined the following:

    systemd.user.mounts = {

        syncDir = {
            Unit = {
                Description = "syncDir mount";
            Mount = {
                What = "/home/dob/nextcloud/syncDir";
                Where = "/home/dob/syncDir";


Rebuilding and switching works, but the mount is not activated. No related mount file shows up when I run ls -al /etc/systemd/system/*.mount, and no entry shows up for journalctl -u syncDir.

Does anyone see what I am doing wrong here, or where I can look to debug potential errors?

Disclaimer: This problem was initially discussed (but not solved) in another topic. This current topic was made for clarity.

Hello again. If it’s done using Home-Manager, you expect the resulting units in $HOME/.config/systemd/user and not under /etc. There is also an example in the original PR in home-manager that does a pretty similar thing that you are trying to achieve.

1 Like

Hello again, and once more thanks for your input, @polygon!

Aha! That makes more sense. However, no unit for the mount was found there either.

Yes. That is the template I did use. I also tried adding:

Type = "fuse.bindfs";
Options = "resolve-symlinks";

It made no difference.

There are not many search hits for β€œsystemd.user.mounts”. Maybe this feature is not working after all?