Samba: Difference between revisions
imported from old wiki |
Migrate config as per https://github.com/NixOS/nixpkgs/pull/302681 |
||
| Line 10: | Line 10: | ||
securityType = "user"; | securityType = "user"; | ||
openFirewall = true; | openFirewall = true; | ||
settings = { | |||
workgroup = WORKGROUP | global = { | ||
"workgroup" = "WORKGROUP"; | |||
"server string" = "smbnix"; | |||
"netbios name" = "smbnix"; | |||
"security" = "user "; | |||
#"use sendfile" = "yes"; | |||
#"max protocol" = "smb2"; | |||
# note: localhost is the ipv6 localhost ::1 | |||
"hosts allow" = "192.168.0. 127.0.0.1 localhost"; | |||
"hosts deny" = "0.0.0.0/0"; | |||
"guest account" = "nobody"; | |||
"map to guest" = "bad user"; | |||
}; | |||
public = { | "public" = { | ||
path = "/mnt/Shares/Public"; | "path" = "/mnt/Shares/Public"; | ||
browseable = "yes"; | "browseable" = "yes"; | ||
"read only" = "no"; | "read only" = "no"; | ||
"guest ok" = "yes"; | "guest ok" = "yes"; | ||
| Line 34: | Line 34: | ||
"force group" = "groupname"; | "force group" = "groupname"; | ||
}; | }; | ||
private = { | "private" = { | ||
path = "/mnt/Shares/Private"; | "path" = "/mnt/Shares/Private"; | ||
browseable = "yes"; | "browseable" = "yes"; | ||
"read only" = "no"; | "read only" = "no"; | ||
"guest ok" = "no"; | "guest ok" = "no"; | ||
| Line 52: | Line 52: | ||
}; | }; | ||
services.avahi = { | |||
publish.enable = true; | |||
publish.userServices = true; | |||
# ^^ Needed to allow samba to automatically register mDNS records (without the need for an `extraServiceFile` | |||
nssmdns4 = true; | |||
# ^^ Not one hundred percent sure if this is needed- if it aint broke, don't fix it | |||
enable = true; | |||
openFirewall = true; | |||
}; | |||
networking.firewall.enable = true; | networking.firewall.enable = true; | ||
| Line 85: | Line 84: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
services.samba = { | services.samba = { | ||
settings = { | |||
tm_share = { | "tm_share" = { | ||
path = "/mnt/Shares/tm_share"; | "path" = "/mnt/Shares/tm_share"; | ||
"valid users" = "username"; | "valid users" = "username"; | ||
public = "no"; | "public" = "no"; | ||
writeable = "yes"; | "writeable" = "yes"; | ||
"force user" = "username"; | "force user" = "username"; | ||
# Below are the most imporant for macOS compatibility | # Below are the most imporant for macOS compatibility | ||
# Change the above to suit your needs | # Change the above to suit your needs | ||
| Line 142: | Line 141: | ||
package = pkgs.sambaFull; | package = pkgs.sambaFull; | ||
openFirewall = true; | openFirewall = true; | ||
settings = { | |||
"load printers" = "yes"; | |||
"printing" = "cups"; | |||
"printcap name" = "cups"; | |||
}; | |||
"printers" = { | |||
printers = { | "comment" = "All Printers"; | ||
comment = "All Printers"; | "path" = "/var/spool/samba"; | ||
path = "/var/spool/samba"; | "public" = "yes"; | ||
public = "yes"; | "browseable" = "yes"; | ||
browseable = "yes"; | |||
# to allow user 'guest account' to print. | # to allow user 'guest account' to print. | ||
"guest ok" = "yes"; | "guest ok" = "yes"; | ||
writable = "no"; | "writable" = "no"; | ||
printable = "yes"; | "printable" = "yes"; | ||
"create mode" = 0700; | "create mode" = 0700; | ||
}; | }; | ||