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