cyrus-sasl: Add saslauthd service support

wip/yesman
roblabla 7 years ago
parent 048114eb4f
commit c18c50a42e
  1. 1
      nixos/modules/module-list.nix
  2. 63
      nixos/modules/services/system/saslauthd.nix
  3. 1
      pkgs/development/libraries/cyrus-sasl/default.nix

@ -534,6 +534,7 @@
./services/system/earlyoom.nix
./services/system/kerberos.nix
./services/system/nscd.nix
./services/system/saslauthd.nix
./services/system/uptimed.nix
./services/torrent/deluge.nix
./services/torrent/flexget.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";
};
};
};
}

@ -34,7 +34,6 @@ stdenv.mkDerivation rec {
# Set this variable at build-time to make sure $out can be evaluated.
preConfigure = ''
configureFlagsArray=( --with-plugindir=$out/lib/sasl2
--with-configdir=$out/lib/sasl2
--with-saslauthd=/run/saslauthd
--enable-login
)

Loading…
Cancel
Save