Migrate from autofs to systemd automount

This commit is contained in:
coolneng 2020-10-21 23:13:58 +02:00
parent a74a6c8aa9
commit 50193e5563
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 28 additions and 12 deletions

View File

@ -88,18 +88,34 @@ in {
};
# Automount external storage
services.autofs = {
enable = true;
timeout = 5;
autoMaster = let
mapConf = pkgs.writeText "auto" ''
usb -fstype=auto :/dev/sdb1
sdcard -fstype=auto :/dev/mmcblk0p1
'';
in ''
/media file:${mapConf} --timeout=5
'';
};
systemd.mounts = [
# USB
{
what = "/dev/sdb1";
where = "/usb";
mountConfig = { TimeoutSec = "5"; };
}
# SD card
{
what = "/dev/mmcblk0p1";
where = "/sdcard";
mountConfig = { TimeoutSec = "5"; };
}
];
systemd.automounts = [
# USB
{
where = "/usb";
automountConfig = { TimeoutIdleSec = "5"; };
wantedBy = [ "default.target" ];
}
# SD card
{
where = "/sdcard";
automountConfig = { TimeoutIdleSec = "5"; };
wantedBy = [ "default.target" ];
}
];
# Integrate pass with the browser
programs.browserpass.enable = true;