summary refs log tree commit diff
path: root/nixos/modules/services/network-filesystems
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2015-04-16 20:16:00 +0300
committerNikolay Amiantov <ab@fmap.me>2015-04-16 20:17:59 +0300
commit0d38958b61c38afd5b6095a3cc519425af823186 (patch)
tree157e34a172cec25882304852552acb58194b11c6 /nixos/modules/services/network-filesystems
parenta0f69df10eff2996224b0d0a4072965bf4d1877f (diff)
downloadnixlib-0d38958b61c38afd5b6095a3cc519425af823186.tar
nixlib-0d38958b61c38afd5b6095a3cc519425af823186.tar.gz
nixlib-0d38958b61c38afd5b6095a3cc519425af823186.tar.bz2
nixlib-0d38958b61c38afd5b6095a3cc519425af823186.tar.lz
nixlib-0d38958b61c38afd5b6095a3cc519425af823186.tar.xz
nixlib-0d38958b61c38afd5b6095a3cc519425af823186.tar.zst
nixlib-0d38958b61c38afd5b6095a3cc519425af823186.zip
nixos.samba: fix booleans in smb.conf
Diffstat (limited to 'nixos/modules/services/network-filesystems')
-rw-r--r--nixos/modules/services/network-filesystems/samba.nix16
1 files changed, 10 insertions, 6 deletions
diff --git a/nixos/modules/services/network-filesystems/samba.nix b/nixos/modules/services/network-filesystems/samba.nix
index d6babb8e9a51..66fa85bbbce3 100644
--- a/nixos/modules/services/network-filesystems/samba.nix
+++ b/nixos/modules/services/network-filesystems/samba.nix
@@ -4,6 +4,10 @@ with lib;
 
 let
 
+  smbToString = x: if builtins.typeOf x == "bool"
+                   then (if x then "true" else "false")
+                   else toString x;
+
   cfg = config.services.samba;
 
   samba = cfg.package;
@@ -15,9 +19,9 @@ let
 
   shareConfig = name:
     let share = getAttr name cfg.shares; in
-    "[${name}]\n " + (toString (
+    "[${name}]\n " + (smbToString (
        map
-         (key: "${key} = ${toString (getAttr key share)}\n")
+         (key: "${key} = ${smbToString (getAttr key share)}\n")
          (attrNames share)
     ));
 
@@ -27,12 +31,12 @@ let
       [ global ]
       security = ${cfg.securityType}
       passwd program = /var/setuid-wrappers/passwd %u
-      pam password change = ${if cfg.syncPasswordsByPam then "yes" else "no"}
-      invalid users = ${toString cfg.invalidUsers}
+      pam password change = ${smbToString cfg.syncPasswordsByPam}
+      invalid users = ${smbToString cfg.invalidUsers}
 
       ${cfg.extraConfig}
 
-      ${toString (map shareConfig (attrNames cfg.shares))}
+      ${smbToString (map shareConfig (attrNames cfg.shares))}
     '');
 
   # This may include nss_ldap, needed for samba if it has to use ldap.
@@ -151,7 +155,7 @@ in
         example =
           { srv =
              { path = "/srv";
-               "read only" = "yes";
+               "read only" = true;
                 comment = "Public samba share.";
              };
           };