From f427bfc67c0552c07158d8b02660ea172c29cbcd Mon Sep 17 00:00:00 2001 From: Grisha Shipunov Date: Sun, 11 Jan 2026 19:38:29 +0100 Subject: minime: config time machine --- hosts/minime/timemachine.nix | 81 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 hosts/minime/timemachine.nix (limited to 'hosts/minime/timemachine.nix') diff --git a/hosts/minime/timemachine.nix b/hosts/minime/timemachine.nix new file mode 100644 index 0000000..988b006 --- /dev/null +++ b/hosts/minime/timemachine.nix @@ -0,0 +1,81 @@ +{ ... }: +{ + 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" ]; + }; +} -- cgit v1.3.1