dotfiles/modules/nixos/services/samba.nix

39 lines
1.1 KiB
Nix
Raw Normal View History

2023-03-05 19:59:58 +00:00
{ config, pkgs, lib, ... }: {
2023-02-28 05:05:04 +00:00
options = { samba.enable = lib.mkEnableOption "Enable Samba sharing."; };
config = {
2023-02-28 05:05:04 +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";
browseable = "yes";
"read only" = "no";
"guest ok" = "no";
"force user" = config.user;
"force group" = config.user;
2023-03-05 20:44:55 +00:00
comment = "NAS";
};
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
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
};
}