diff options
author | roblabla <robinlambertz+dev@gmail.com> | 2017-06-06 12:59:47 +0200 |
---|---|---|
committer | roblabla <robinlambertz+dev@gmail.com> | 2017-06-06 12:59:47 +0200 |
commit | c18c50a42e68e5327d8612d5aed2e25d094205d3 (patch) | |
tree | 6e351c1300685deb5bde005cea72fdb23bfa57ea /nixos/modules/services/system/saslauthd.nix | |
parent | 048114eb4f79f3e125dadee106b454e3d72ccdfc (diff) | |
download | nixpkgs-c18c50a42e68e5327d8612d5aed2e25d094205d3.tar nixpkgs-c18c50a42e68e5327d8612d5aed2e25d094205d3.tar.gz nixpkgs-c18c50a42e68e5327d8612d5aed2e25d094205d3.tar.bz2 nixpkgs-c18c50a42e68e5327d8612d5aed2e25d094205d3.tar.lz nixpkgs-c18c50a42e68e5327d8612d5aed2e25d094205d3.tar.xz nixpkgs-c18c50a42e68e5327d8612d5aed2e25d094205d3.tar.zst nixpkgs-c18c50a42e68e5327d8612d5aed2e25d094205d3.zip |
cyrus-sasl: Add saslauthd service support
Diffstat (limited to 'nixos/modules/services/system/saslauthd.nix')
-rw-r--r-- | nixos/modules/services/system/saslauthd.nix | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/nixos/modules/services/system/saslauthd.nix b/nixos/modules/services/system/saslauthd.nix new file mode 100644 index 00000000000..281716cf186 --- /dev/null +++ b/nixos/modules/services/system/saslauthd.nix @@ -0,0 +1,63 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + nssModulesPath = config.system.nssModules.path; + cfg = config.services.saslauthd; + +in + +{ + + ###### interface + + options = { + + services.saslauthd = { + + enable = mkEnableOption "Whether to enable the Cyrus SASL authentication daemon."; + + package = mkOption { + default = pkgs.cyrus_sasl.bin; + defaultText = "pkgs.cyrus_sasl.bin"; + type = types.package; + description = "Cyrus SASL package to use."; + }; + + mechanism = mkOption { + type = types.str; + default = "pam"; + description = "Auth mechanism to use"; + }; + + config = mkOption { + type = types.lines; + default = ""; + description = "Configuration to use for Cyrus SASL authentication daemon."; + }; + + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + systemd.services.saslauthd = { + description = "Cyrus SASL authentication daemon"; + + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + ExecStart = "@${cfg.package}/sbin/saslauthd saslauthd -a ${cfg.mechanism} -O ${pkgs.writeText "saslauthd.conf" cfg.config}"; + Type = "forking"; + PIDFile = "/run/saslauthd/saslauthd.pid"; + Restart = "always"; + }; + }; + }; +} |