nixpkgs/modules/services/databases/memcached.nix
2013-06-23 18:49:49 +01:00

62 lines
983 B
Nix

{ config, pkgs, ... }:
with pkgs.lib;
let
cfg = config.services.memcached;
memcached = pkgs.memcached;
in
{
###### interface
options = {
services.memcached = {
enable = mkOption {
default = false;
description = "
Whether to enable Memcached.
";
};
user = mkOption {
default = "memcached";
description = "The user to run Memcached as";
};
};
};
###### implementation
config = mkIf config.services.memcached.enable {
users.extraUsers = singleton
{ name = cfg.user;
description = "Memcached server user";
};
environment.systemPackages = [ memcached ];
systemd.services.memcached =
{ description = "Memcached server";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${memcached}/bin/memcached";
User = cfg.user;
};
};
};
}