I (=Nix newbie) am really struggling to get Samba running on NixOS. I have installed Samba before (@Debian) without any issues, so it’s probably a “Nix logic” error of mine. Any help appreciated!
1) The issue:
When trying to start smb services, I get:
$ testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed by GnuTLS (e.g. NTLM as a compatibility fallback)
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
# Global parameters
[global]
map to guest = Bad User
netbios name = SMBNIX
passwd program = /run/wrappers/bin/passwd %u
security = USER
server string = smbnix
idmap config * : backend = tdb
hosts allow = 192.168.0. 127.0.0.1 localhost
hosts deny = 0.0.0.0/0
invalid users = root
[private]
create mask = 0644
force group = samba_users
force user= fulanito, menganito
path = /xxx/xxx/xxx/
read only = No
[public]
create mask = 0644
force group = samba_users
force user= fulanito, menganito
guest ok = Yes
path= /xxx/xxx/xxx/
read only = No
$ sudo systemctl restart samba
Failed to restart samba.service: Unit samba.service not found.
2) Installed package:
$ nix-env --query
samba-4.20.4
3) configuration.nix:
The samba-snippets from my config-file:
# Samba
services.samba = {
enable = true;
openFirewall = true;
settings = {
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" = "1xx.1xx.0. 127.0.0.1 localhostt";
"hosts deny" = "0.0.0.0/0";
"guest account" = "nobody";
"map to guest" = "bad user";
};
"public" = {
path = "/xxx/xxx/xxx/";
"browseable" = "yes";
"read only" = "no";
"guest ok" = "yes";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "fulanito, menganito";
"force group" = "samba_users";
};
private = {
path = "/xxx/xxx/xxx";
browseable = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "fulanito, menganito";
"force group" = "samba_users";
};
};
};
services.samba-wsdd = {
enable = true;
openFirewall = true;
};
networking.firewall.enable = true;
networking.firewall.allowPing = true;
4) smb.conf:
[global]
guest account=nobody
hosts allow=1xx.1xx.0. 127.0.0.1 localhost
hosts deny=0.0.0.0/0
invalid users=root
map to guest=bad user
netbios name=smbnix
passwd program=/run/wrappers/bin/passwd %u
security=user
server string=smbnix
workgroup=WORKGROUP
[private]
browseable=yes
create mask=0644
directory mask=0755
force group=samba_users
force user=fulanito, menganito
guest ok=no
path=/xxx/xxx/xxx/
read only=no
[public]
browseable=yes
create mask=0644
directory mask=0755
force group=samba_users
force user=fulanito, menganito
guest ok=yes
path=/xxx/xxx/xxx/
read only=no
5. Groups, Services:
/etc/group
samba_users:x:1000:tototl,nehuatl,root
/etc/services:
Neither smbd.service nor nmbd.service (or the like) listed, only:
smbdirect 5445/sctp # Server Message Block over Remote Direct Memory Access