nixos/modules/networking/samba.nix

46 lines
1.2 KiB
Nix
Raw Normal View History

2023-06-24 23:00:02 +08:00
inputs:
2023-06-20 15:44:34 +08:00
{
config =
{
# make shares visible for windows 10 clients
services.samba-wsdd.enable = true;
# networking.firewall = { allowedTCPPorts = [ 5357 ]; allowedUDPPorts = [ 3702 ]; };
services.samba =
{
enable = true;
securityType = "user";
2023-07-24 12:52:21 +08:00
enableWinbindd = true;
2023-06-20 15:44:34 +08:00
extraConfig =
''
workgroup = WORKGROUP
server string = Samba Server
server role = standalone server
hosts allow = 192.168. 127.
dns proxy = no
'';
2023-06-20 16:07:03 +08:00
shares = builtins.listToAttrs (builtins.map
(config: { name = config.name; value =
2023-06-20 15:44:34 +08:00
{
2023-06-20 16:07:03 +08:00
comment = config.comment;
path = config.path;
2023-06-20 15:44:34 +08:00
browseable = true;
writeable = true;
2023-06-20 16:10:19 +08:00
"create mask" = "664";
"force create mode" = "644";
"security mask" = "644";
"force security mode" = "644";
"directory mask" = "2755";
"force directory mode" = "2755";
"directory security mask" = "2755";
"force directory security mode" = "2755";
2023-06-20 16:07:03 +08:00
}; })
[
2023-06-20 16:10:19 +08:00
{ name = "media"; comment = "chn media"; path = "/run/media/chn"; }
{ name = "home"; comment = "chn home"; path = "/home/chn"; }
{ name = "mnt"; comment = "mnt"; path = "/mnt"; }
{ name = "share"; comment = "chn share"; path = "/home/chn/share"; }
2023-06-20 16:07:03 +08:00
]);
2023-06-20 15:44:34 +08:00
};
};
}