Hello,
I have been looking everywhere for a way to mount bitlocker encrypted NTFS drives automatically at login but can’t seem to find any information? The closest I got was this issue Mount bitlocker volumes automatically, but it never seems to have been resolved.
I dual-boot my system because there are unfortunately still some things that only work on Windows. Currently I have two large data drives in my system that I use to hold all my media and a lot of documents, etc. I would like to automatically mount them in my NixOS system at /home//Videos and /home//Pictures so that I can share the drive space across the systems.
Unfortunately I can’t find a good way to do this. So far this is the best thing I have come up with:
# Decrypt NTFS disks
environment.etc."crypttab".text = ''
# <name> <device> <password> <options>
big_data_drive UUID=72ee119e-a55c-48a0-923a-61df681c9833 none bitlk
bigger_data_drive UUID=2549c7d1-370f-40a6-a211-3e5db0cab7c7 none bitlk
'';
# Mount at the media volumes
fileSystems."/mnt/big_data_drive" = {
device = "/dev/mapper/big_data_drive";
fsType = "ntfs3";
options = ["rw" "uid=1000" "gid=100" "umask=007" "noauto" "x-systemd.automount"];
};
fileSystems."/mnt/bigger_data_drive" = {
device = "/dev/mapper/bigger_data_drive";
fsType = "ntfs3";
options = ["rw" "uid=1000" "gid=100" "umask=007" "noauto" "x-systemd.automount"];
};
But unfortunately this doesn’t seem to build correctly. I get the following error when I try to nixos-rebuild switch:
activating the configuration...
setting up /etc...
reloading user units for <user>...
restarting sysinit-reactivation.target
Error: Failed to open unit file /nix/store/4030z4hs4a1zaa3clxfnsnah4vz8m3rb-nixos-system-nixos-25.05.20250819.a58390a/etc/systemd/system/mnt-bigger_data_drive.mount
Caused by:
No such file or directory (os error 2)
warning: error(s) occurred while switching to the new configuration
Is this possible?