{ 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 = '' %h _smb._tcp 445 _device-info._tcp 0 model=TimeCapsule8,119 _adisk._tcp dk0=adVN=timemachine,adVF=0x82 sys=waMa=0,adVF=0x100 ''; }; }; }; }