blob: 988b0067fe542d50977845e3d9b3a56836afb53d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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 = ''
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_smb._tcp</type>
<port>445</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=TimeCapsule8,119</txt-record>
</service>
<service>
<type>_adisk._tcp</type>
<!--
change tm_share to share name, if you changed it.
-->
<txt-record>dk0=adVN=tm_share,adVF=0x82</txt-record>
<txt-record>sys=waMa=0,adVF=0x100</txt-record>
</service>
</service-group>
'';
};
};
fileSystems."/srv/timemachine" = {
device = "zpool/backup/timemachine";
fsType = "zfs";
options = [ "zfsutil" ];
};
}
|