nixos.samba: fix booleans in smb.conf
This commit is contained in:
@@ -4,6 +4,10 @@ with lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
smbToString = x: if builtins.typeOf x == "bool"
|
||||||
|
then (if x then "true" else "false")
|
||||||
|
else toString x;
|
||||||
|
|
||||||
cfg = config.services.samba;
|
cfg = config.services.samba;
|
||||||
|
|
||||||
samba = cfg.package;
|
samba = cfg.package;
|
||||||
@@ -15,9 +19,9 @@ let
|
|||||||
|
|
||||||
shareConfig = name:
|
shareConfig = name:
|
||||||
let share = getAttr name cfg.shares; in
|
let share = getAttr name cfg.shares; in
|
||||||
"[${name}]\n " + (toString (
|
"[${name}]\n " + (smbToString (
|
||||||
map
|
map
|
||||||
(key: "${key} = ${toString (getAttr key share)}\n")
|
(key: "${key} = ${smbToString (getAttr key share)}\n")
|
||||||
(attrNames share)
|
(attrNames share)
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -27,12 +31,12 @@ let
|
|||||||
[ global ]
|
[ global ]
|
||||||
security = ${cfg.securityType}
|
security = ${cfg.securityType}
|
||||||
passwd program = /var/setuid-wrappers/passwd %u
|
passwd program = /var/setuid-wrappers/passwd %u
|
||||||
pam password change = ${if cfg.syncPasswordsByPam then "yes" else "no"}
|
pam password change = ${smbToString cfg.syncPasswordsByPam}
|
||||||
invalid users = ${toString cfg.invalidUsers}
|
invalid users = ${smbToString cfg.invalidUsers}
|
||||||
|
|
||||||
${cfg.extraConfig}
|
${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.
|
# This may include nss_ldap, needed for samba if it has to use ldap.
|
||||||
@@ -151,7 +155,7 @@ in
|
|||||||
example =
|
example =
|
||||||
{ srv =
|
{ srv =
|
||||||
{ path = "/srv";
|
{ path = "/srv";
|
||||||
"read only" = "yes";
|
"read only" = true;
|
||||||
comment = "Public samba share.";
|
comment = "Public samba share.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user