How to automount partition

I want to automount this partition

/dev/sda8  727326720 937701375 210374656 100.3G Microsoft basic data

The GUID is 701FE3AE54D4CE16

have a look at this

What should I put after fileSystems.
The example in that thread is like this:

fileSystems."/drives/Windows" =

the directory you want to mount your disk to
for example if in the past you used

sudo mound /dev/sda8 /path/to/some-dir

now you use this

  fileSystems."/path/to/some-dir" = {
    device = "/dev/disk/by-uuid/701FE3AE54D4CE16";
  };

I check where the partition was currently mounted, and accordingly, I put this in the config

#Automount
  fileSystems."/run/media/shmuel" = {
    device = "/dev/disk/by-uuid/701FE3AE54D4CE16";
  };

and when I rebuilt, it crashed the session and went to tty.

to be honest I have no idea
is the device connected? what if you try with an existing emtpy directory in your home folder

It’s connected. It is a partition on same disk that NixOS is installed on.

I think the problem is that the partition needs to be owned by root in order for this to work.

sorry idk it just worked fine for me

You can try adding:

      options = [ "nofail" "x-systemd.automount" ];

I have an external USB drive that would prevent booting when I had it configured but it wasn’t plugged in or powered until I added the nofail option. The x-systemd.automount option sets up a systemd unit to mount when it gets plugged in so you may not need that part.

If you add this to your config and boot, then you might be able to find out why it’s not working from dmesg or your logs, which may confirm your ownership theory or it might be something else. My USB drive isn’t owned by root so that may not be the case, but at least you’ll get some more information.