nixos/samba: only create /etc/samba/smb.conf when samba is enabled

This commit is contained in:
Anthony Roussel 2024-06-07 08:43:54 +02:00
parent 4f4846ed59
commit 46db91c0d7
No known key found for this signature in database
GPG Key ID: 9DC4987B1A55E75E

View File

@ -201,14 +201,10 @@ in
message = "If samba.nsswins is enabled, then samba.enableWinbindd must also be enabled";
}
];
# Always provide a smb.conf to shut up programs like smbclient and smbspool.
environment.etc."samba/smb.conf".source = mkOptionDefault (
if cfg.enable then configFile
else pkgs.writeText "smb-dummy.conf" "# Samba is disabled."
);
}
(mkIf cfg.enable {
environment.etc."samba/smb.conf".source = configFile;
system.nssModules = optional cfg.nsswins samba;
system.nssDatabases.hosts = optional cfg.nsswins "wins";