98 lines
2.5 KiB
Nix
98 lines
2.5 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
# define smb shares
|
|
let
|
|
cfg = config.holocron.smb;
|
|
smb_shares = {
|
|
global = {
|
|
"ea support" = "yes";
|
|
"vfs objects" = "catia fruit streams_xattr";
|
|
"fruit:aapl" = "yes";
|
|
"fruit:metadata" = "stream";
|
|
"fruit:model" = "MacSamba";
|
|
"fruit:posix_rename" = "yes";
|
|
"fruit:nfs_aces" = "no";
|
|
"fruit:veto_appledouble" = "no";
|
|
"fruit:wipe_intentionally_left_blank_rfork" = "yes";
|
|
"fruit:delete_empty_adfiles" = "yes";
|
|
};
|
|
archives = {
|
|
path = "/holocron/archives";
|
|
browseable = true;
|
|
writable = true;
|
|
guestOk = false;
|
|
"create mask" = "0775";
|
|
"directory mask" = "0775";
|
|
};
|
|
timemachine = {
|
|
browseable = true;
|
|
"path" = "/holocron/archives/timemachine";
|
|
"valid users" = "blake";
|
|
"public" = "no";
|
|
"writeable" = "yes";
|
|
"force user" = "blake";
|
|
"fruit:aapl" = "yes";
|
|
"fruit:time machine" = "yes";
|
|
"vfs objects" = "catia fruit streams_xattr";
|
|
};
|
|
users = {
|
|
path = "/holocron/users";
|
|
browseable = true;
|
|
writable = true;
|
|
guestOk = false;
|
|
"create mask" = "0660";
|
|
"directory mask" = "0770";
|
|
};
|
|
media = {
|
|
path = "/holocron/media";
|
|
browseable = true;
|
|
writable = true;
|
|
guestOk = false;
|
|
"create mask" = "0775";
|
|
"directory mask" = "0775";
|
|
};
|
|
};
|
|
in {
|
|
options.holocron.smb = {
|
|
enable = lib.mkEnableOption "enables smb";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# enable smb with all shares
|
|
services.samba = {
|
|
enable = true;
|
|
settings = smb_shares;
|
|
};
|
|
# Ensure Time Machine can discover the share without `tmutil`
|
|
services.avahi = {
|
|
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>
|
|
<txt-record>dk0=adVN=timemachine,adVF=0x82</txt-record>
|
|
<txt-record>sys=waMa=0,adVF=0x100</txt-record>
|
|
</service>
|
|
</service-group>
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
}
|