summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2019-11-08 23:25:55 +0100
committerFlorian Klink <flokli@flokli.de>2019-11-08 23:25:55 +0100
commit18f9cfa1c087ec8eb040c7032ca0f6016984e053 (patch)
treeb319ad679fc313bb0ed85d0108d0a54162355eac /nixos
parent3928e7f6b1d597d20bf4bf23a2b633e1a7c061f8 (diff)
downloadnixpkgs-18f9cfa1c087ec8eb040c7032ca0f6016984e053.tar
nixpkgs-18f9cfa1c087ec8eb040c7032ca0f6016984e053.tar.gz
nixpkgs-18f9cfa1c087ec8eb040c7032ca0f6016984e053.tar.bz2
nixpkgs-18f9cfa1c087ec8eb040c7032ca0f6016984e053.tar.lz
nixpkgs-18f9cfa1c087ec8eb040c7032ca0f6016984e053.tar.xz
nixpkgs-18f9cfa1c087ec8eb040c7032ca0f6016984e053.tar.zst
nixpkgs-18f9cfa1c087ec8eb040c7032ca0f6016984e053.zip
nixos/samba: update module to use tmpfiles, remove samba-setup service
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/network-filesystems/samba.nix20
1 files changed, 8 insertions, 12 deletions
diff --git a/nixos/modules/services/network-filesystems/samba.nix b/nixos/modules/services/network-filesystems/samba.nix
index ce565dbaab8..83995d28179 100644
--- a/nixos/modules/services/network-filesystems/samba.nix
+++ b/nixos/modules/services/network-filesystems/samba.nix
@@ -12,11 +12,6 @@ let
 
   samba = cfg.package;
 
-  setupScript =
-    ''
-      mkdir -p /var/lock/samba /var/log/samba /var/cache/samba /var/lib/samba/private
-    '';
-
   shareConfig = name:
     let share = getAttr name cfg.shares; in
     "[${name}]\n " + (smbToString (
@@ -62,6 +57,7 @@ let
         Type = "notify";
         NotifyAccess = "all"; #may not do anything...
       };
+      unitConfig.RequiresMountsFor = "/var/lib/samba";
 
       restartTriggers = [ configFile ];
     };
@@ -228,8 +224,7 @@ in
         systemd = {
           targets.samba = {
             description = "Samba Server";
-            requires = [ "samba-setup.service" ];
-            after = [ "samba-setup.service" "network.target" ];
+            after = [ "network.target" ];
             wantedBy = [ "multi-user.target" ];
           };
           # Refer to https://github.com/samba-team/samba/tree/master/packaging/systemd
@@ -238,12 +233,13 @@ in
             samba-smbd = daemonService "smbd" "";
             samba-nmbd = mkIf cfg.enableNmbd (daemonService "nmbd" "");
             samba-winbindd = mkIf cfg.enableWinbindd (daemonService "winbindd" "");
-            samba-setup = {
-              description = "Samba Setup Task";
-              script = setupScript;
-              unitConfig.RequiresMountsFor = "/var/lib/samba";
-            };
           };
+          tmpfiles.rules = [
+            "d /var/lock/samba - - - - -"
+            "d /var/log/samba - - - - -"
+            "d /var/cache/samba - - - - -"
+            "d /var/lib/samba/private - - - - -"
+          ];
         };
 
         security.pam.services.samba = {};