2024-01-10 04:11:11 +00:00
|
|
|
# Samba is a Windows-compatible file-sharing service.
|
|
|
|
|
2024-04-20 13:42:06 +00:00
|
|
|
{ config, lib, ... }:
|
|
|
|
{
|
2023-02-28 05:05:04 +00:00
|
|
|
|
2023-03-02 19:49:20 +00:00
|
|
|
config = {
|
2023-02-28 05:05:04 +00:00
|
|
|
|
2023-07-04 22:20:43 +00:00
|
|
|
services.samba = lib.mkIf config.services.samba.enable {
|
2023-03-05 19:59:58 +00:00
|
|
|
openFirewall = true;
|
2023-03-06 04:46:12 +00:00
|
|
|
shares.data = {
|
2023-03-05 20:44:55 +00:00
|
|
|
path = "/data";
|
2023-03-02 19:49:20 +00:00
|
|
|
browseable = "yes";
|
|
|
|
"read only" = "no";
|
|
|
|
"guest ok" = "no";
|
2023-03-05 20:44:55 +00:00
|
|
|
comment = "NAS";
|
2023-03-02 19:49:20 +00:00
|
|
|
};
|
2023-02-28 05:05:04 +00:00
|
|
|
};
|
|
|
|
|
2023-03-06 04:46:12 +00:00
|
|
|
# Allows Windows clients to discover server
|
|
|
|
services.samba-wsdd.enable = true;
|
|
|
|
networking.firewall.allowedTCPPorts = [ 5357 ];
|
|
|
|
networking.firewall.allowedUDPPorts = [ 3702 ];
|
|
|
|
|
2023-03-06 04:47:52 +00:00
|
|
|
# Allow client browsing Samba and virtual filesystem shares
|
2024-04-20 13:42:06 +00:00
|
|
|
services.gvfs = lib.mkIf (config.gui.enable && config.nautilus.enable) { enable = true; };
|
2023-03-02 19:49:20 +00:00
|
|
|
|
2023-03-06 04:47:52 +00:00
|
|
|
# # Permissions required to mount Samba with GVFS, if not using desktop environment
|
|
|
|
# environment.systemPackages = lib.mkIf (config.gui.enable
|
|
|
|
# && config.nautilus.enable
|
|
|
|
# && config.services.xserver.windowManager.i3.enable)
|
|
|
|
# [ pkgs.lxqt.lxqt-policykit ];
|
2023-02-28 05:05:04 +00:00
|
|
|
};
|
|
|
|
}
|