2023-03-26 20:52:28 +00:00
|
|
|
{ config, lib, ... }: {
|
2023-02-28 05:05:04 +00:00
|
|
|
|
|
|
|
options = { samba.enable = lib.mkEnableOption "Enable Samba sharing."; };
|
|
|
|
|
2023-03-02 19:49:20 +00:00
|
|
|
config = {
|
2023-02-28 05:05:04 +00:00
|
|
|
|
2023-03-02 19:49:20 +00:00
|
|
|
services.samba = lib.mkIf (config.samba.enable) {
|
|
|
|
enable = true;
|
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
|
2023-03-02 19:49:20 +00:00
|
|
|
services.gvfs =
|
|
|
|
lib.mkIf (config.gui.enable && config.nautilus.enable) { enable = true; };
|
|
|
|
|
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-03-05 19:59:58 +00:00
|
|
|
|
2023-02-28 05:05:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|