{ ... }: { users.groups.time_machine = {}; users.users.time_machine = { isSystemUser = true; group = "time_machine"; }; networking.firewall.interfaces.enp90s0.allowedTCPPorts = [ 445 ]; networking.firewall.interfaces.enp90s0.allowedUDPPorts = [ 445 ]; services.samba = { enable = true; settings = { global = { "workgroup" = "WORKGROUP"; "server string" = "smbnix"; "netbios name" = "smbnix"; "security" = "user"; # Only available on localhost and lan "hosts allow" = "192.168.2.0/24 127.0.0.1 localhost"; "hosts deny" = "0.0.0.0/0"; "guest account" = "nobody"; "map to guest" = "bad user"; }; "tm_share" = { "path" = "/srv/timemachine"; "valid users" = "time_machine"; "public" = "no"; "writable" = "yes"; "force user" = "time_machine"; "fruit:aapl" = "yes"; "fruit:time machine" = "yes"; "vfs objects" = "catia fruit streams_xattr"; }; }; }; services.avahi = { enable = true; publish.enable = true; publish.userServices = true; nssmdns4 = true; # https://wiki.nixos.org/wiki/Samba#Apple_Time_Machine extraServiceFiles = { timemachine = '' %h _smb._tcp 445 _device-info._tcp 0 model=TimeCapsule8,119 _adisk._tcp dk0=adVN=tm_share,adVF=0x82 sys=waMa=0,adVF=0x100 ''; }; }; fileSystems."/srv/timemachine" = { device = "zpool/backup/timemachine"; fsType = "zfs"; options = [ "zfsutil" ]; }; }