dotfiles.nix/nixos/common/users/sajenim/samba/default.nix

26 lines
732 B
Nix
Raw Normal View History

2024-07-16 21:27:20 +08:00
{ pkgs, config, ... }:
2024-06-03 21:10:23 +08:00
{
age.secrets.smb-secrets = {
rekeyFile = ./smb-secrets.age;
};
2024-07-16 21:27:20 +08:00
# For mount.cifs, required unless domain name resolution is not needed.
environment.systemPackages = [ pkgs.cifs-utils ];
2024-06-03 21:10:23 +08:00
fileSystems."/home/sajenim/.backup" = {
2024-07-16 21:27:20 +08:00
device = "//192.168.20.4/sajenim";
2024-06-03 21:10:23 +08:00
fsType = "cifs";
options = let
2024-07-16 21:27:20 +08:00
# this line prevents hanging on network split
2024-06-03 21:10:23 +08:00
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user,users";
in ["${automount_opts},credentials=/etc/nixos/smb-secrets,uid=1000,gid=100"];
};
environment.etc = {
"nixos/smb-secrets".source = config.age.secrets.smb-secrets.path;
};
}