Currently, I’m mounting 3 Samba directories with the following config
fileSystems."/mnt/data-raid" = {
device = "//192.168.179.69/data-raid";
fsType = "cifs";
options = let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in [ "${automount_opts},credentials=/home/${user}/smb-secrets" ];
};
fileSystems."/mnt/data-wd" = {
device = "//192.168.179.69/data-wd";
fsType = "cifs";
options = let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in [ "${automount_opts},credentials=/home/${user}/smb-secrets" ];
};
fileSystems."/mnt/data-buffalo" = {
device = "//192.168.179.69/data-buffalo";
fsType = "cifs";
options = let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in [ "${automount_opts},credentials=/home/${user}/smb-secrets" ];
};
As you can see, the following part is repeated 3 times
fsType = "cifs";
options = let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in [ "${automount_opts},credentials=/home/${user}/smb-secrets" ];
Is there any way I can make this common setting into one place?