From 753d9d4e4fb3d773c93ba005007c6578edd4bf7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sat, 6 Sep 2014 00:45:47 +0200 Subject: [PATCH] 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. --- nixos/modules/misc/ids.nix | 4 +- .../services/network-filesystems/samba.nix | 41 +------------------ 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index cdce7d1a893..cd5e6019cef 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -82,7 +82,7 @@ statsd = 69; transmission = 70; postgres = 71; - smbguest = 74; + smbguest = 74; # unused varnish = 75; datadog = 76; lighttpd = 77; @@ -220,7 +220,7 @@ postgres = 71; vboxusers = 72; vboxsf = 73; - smbguest = 74; + smbguest = 74; # unused varnish = 75; datadog = 76; lighttpd = 77; diff --git a/nixos/modules/services/network-filesystems/samba.nix b/nixos/modules/services/network-filesystems/samba.nix index 4218b965cd9..410a429621b 100644 --- a/nixos/modules/services/network-filesystems/samba.nix +++ b/nixos/modules/services/network-filesystems/samba.nix @@ -6,9 +6,6 @@ let cfg = config.services.samba; - user = "smbguest"; - group = "smbguest"; - logDir = "/var/log/samba"; privateDir = "/var/samba/private"; @@ -16,12 +13,6 @@ let 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 mkdir -p /var/samba/locks /var/samba/cores/nmbd /var/samba/cores/smbd /var/samba/cores/winbindd fi @@ -43,13 +34,6 @@ let private dir = ${privateDir} ${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} ''; @@ -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 { description = "Samba security type"; default = "user"; @@ -199,14 +168,6 @@ in (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; systemd = { @@ -224,7 +185,7 @@ in "samba-setup" = { description = "Samba Setup Task"; script = setupScript; - unitConfig.RequiresMountsFor = "/home/smbd /var/samba /var/log/samba"; + unitConfig.RequiresMountsFor = "/var/samba /var/log/samba"; }; }; };