at 17.09-beta 1.3 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 nssModulesPath = config.system.nssModules.path; 8 cfg = config.services.saslauthd; 9 10in 11 12{ 13 14 ###### interface 15 16 options = { 17 18 services.saslauthd = { 19 20 enable = mkEnableOption "Whether to enable the Cyrus SASL authentication daemon."; 21 22 package = mkOption { 23 default = pkgs.cyrus_sasl.bin; 24 defaultText = "pkgs.cyrus_sasl.bin"; 25 type = types.package; 26 description = "Cyrus SASL package to use."; 27 }; 28 29 mechanism = mkOption { 30 type = types.str; 31 default = "pam"; 32 description = "Auth mechanism to use"; 33 }; 34 35 config = mkOption { 36 type = types.lines; 37 default = ""; 38 description = "Configuration to use for Cyrus SASL authentication daemon."; 39 }; 40 41 }; 42 43 }; 44 45 46 ###### implementation 47 48 config = mkIf cfg.enable { 49 50 systemd.services.saslauthd = { 51 description = "Cyrus SASL authentication daemon"; 52 53 wantedBy = [ "multi-user.target" ]; 54 55 serviceConfig = { 56 ExecStart = "@${cfg.package}/sbin/saslauthd saslauthd -a ${cfg.mechanism} -O ${pkgs.writeText "saslauthd.conf" cfg.config}"; 57 Type = "forking"; 58 PIDFile = "/run/saslauthd/saslauthd.pid"; 59 Restart = "always"; 60 }; 61 }; 62 }; 63}