nixos/samba: remove services.samba.defaultShare option
It's not that difficult to define shares using standard samba config file syntax, so why do we need the semi-configurable .defaultShare option? Also: * It uses /home/smbd and I think /home should be reserved for real human users. * If enabled, it breaks the assumption that .extraConfig continues in the [global] section. Without .defaultShare there is no need for the "smbguest" user and group either, mark them as unused.
This commit is contained in:
parent
614a99bd8e
commit
753d9d4e4f
|
@ -82,7 +82,7 @@
|
||||||
statsd = 69;
|
statsd = 69;
|
||||||
transmission = 70;
|
transmission = 70;
|
||||||
postgres = 71;
|
postgres = 71;
|
||||||
smbguest = 74;
|
smbguest = 74; # unused
|
||||||
varnish = 75;
|
varnish = 75;
|
||||||
datadog = 76;
|
datadog = 76;
|
||||||
lighttpd = 77;
|
lighttpd = 77;
|
||||||
|
@ -220,7 +220,7 @@
|
||||||
postgres = 71;
|
postgres = 71;
|
||||||
vboxusers = 72;
|
vboxusers = 72;
|
||||||
vboxsf = 73;
|
vboxsf = 73;
|
||||||
smbguest = 74;
|
smbguest = 74; # unused
|
||||||
varnish = 75;
|
varnish = 75;
|
||||||
datadog = 76;
|
datadog = 76;
|
||||||
lighttpd = 77;
|
lighttpd = 77;
|
||||||
|
|
|
@ -6,9 +6,6 @@ let
|
||||||
|
|
||||||
cfg = config.services.samba;
|
cfg = config.services.samba;
|
||||||
|
|
||||||
user = "smbguest";
|
|
||||||
group = "smbguest";
|
|
||||||
|
|
||||||
logDir = "/var/log/samba";
|
logDir = "/var/log/samba";
|
||||||
privateDir = "/var/samba/private";
|
privateDir = "/var/samba/private";
|
||||||
|
|
||||||
|
@ -16,12 +13,6 @@ let
|
||||||
|
|
||||||
setupScript =
|
setupScript =
|
||||||
''
|
''
|
||||||
if ! test -d /home/smbd ; then
|
|
||||||
mkdir -p /home/smbd
|
|
||||||
chown ${user} /home/smbd
|
|
||||||
chmod a+rwx /home/smbd
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! test -d /var/samba ; then
|
if ! test -d /var/samba ; then
|
||||||
mkdir -p /var/samba/locks /var/samba/cores/nmbd /var/samba/cores/smbd /var/samba/cores/winbindd
|
mkdir -p /var/samba/locks /var/samba/cores/nmbd /var/samba/cores/smbd /var/samba/cores/winbindd
|
||||||
fi
|
fi
|
||||||
|
@ -43,13 +34,6 @@ let
|
||||||
private dir = ${privateDir}
|
private dir = ${privateDir}
|
||||||
${optionalString cfg.syncPasswordsByPam "pam password change = true"}
|
${optionalString cfg.syncPasswordsByPam "pam password change = true"}
|
||||||
|
|
||||||
${if cfg.defaultShare.enable then ''
|
|
||||||
[default]
|
|
||||||
path = /home/smbd
|
|
||||||
read only = ${if cfg.defaultShare.writeable then "no" else "yes"}
|
|
||||||
guest ok = ${if cfg.defaultShare.guest then "yes" else "no"}
|
|
||||||
''else ""}
|
|
||||||
|
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -149,21 +133,6 @@ in
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultShare = {
|
|
||||||
enable = mkOption {
|
|
||||||
description = "Whether to share /home/smbd as 'default'.";
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
writeable = mkOption {
|
|
||||||
description = "Whether to allow write access to default share.";
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
guest = mkOption {
|
|
||||||
description = "Whether to allow guest access to default share.";
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
securityType = mkOption {
|
securityType = mkOption {
|
||||||
description = "Samba security type";
|
description = "Samba security type";
|
||||||
default = "user";
|
default = "user";
|
||||||
|
@ -199,14 +168,6 @@ in
|
||||||
|
|
||||||
(mkIf config.services.samba.enable {
|
(mkIf config.services.samba.enable {
|
||||||
|
|
||||||
users.extraUsers.smbguest = {
|
|
||||||
description = "Samba service user";
|
|
||||||
group = group;
|
|
||||||
uid = config.ids.uids.smbguest;
|
|
||||||
};
|
|
||||||
|
|
||||||
users.extraGroups.smbguest.gid = config.ids.uids.smbguest;
|
|
||||||
|
|
||||||
system.nssModules = optional cfg.nsswins samba;
|
system.nssModules = optional cfg.nsswins samba;
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
|
@ -224,7 +185,7 @@ in
|
||||||
"samba-setup" = {
|
"samba-setup" = {
|
||||||
description = "Samba Setup Task";
|
description = "Samba Setup Task";
|
||||||
script = setupScript;
|
script = setupScript;
|
||||||
unitConfig.RequiresMountsFor = "/home/smbd /var/samba /var/log/samba";
|
unitConfig.RequiresMountsFor = "/var/samba /var/log/samba";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue