mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
* Added a module for the RabbitMQ server.
svn path=/nixos/trunk/; revision=26630
This commit is contained in:
parent
e174562ee1
commit
c4a2eeb9f8
2 changed files with 91 additions and 0 deletions
|
@ -44,6 +44,7 @@
|
||||||
./security/polkit.nix
|
./security/polkit.nix
|
||||||
./security/setuid-wrappers.nix
|
./security/setuid-wrappers.nix
|
||||||
./security/sudo.nix
|
./security/sudo.nix
|
||||||
|
./services/amqp/rabbitmq.nix
|
||||||
./services/audio/alsa.nix
|
./services/audio/alsa.nix
|
||||||
./services/audio/pulseaudio.nix
|
./services/audio/pulseaudio.nix
|
||||||
./services/backup/hydra-mirror.nix
|
./services/backup/hydra-mirror.nix
|
||||||
|
|
90
modules/services/amqp/rabbitmq.nix
Normal file
90
modules/services/amqp/rabbitmq.nix
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.services.rabbitmq;
|
||||||
|
|
||||||
|
run = cmd: "${pkgs.sudo}/bin/sudo -E -u rabbitmq ${cmd}";
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.rabbitmq = {
|
||||||
|
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable the RabbitMQ server, an Advanced Message
|
||||||
|
Queuing Protocol (AMQP) broker.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
listenAddress = mkOption {
|
||||||
|
default = "127.0.0.1";
|
||||||
|
example = "";
|
||||||
|
description = ''
|
||||||
|
IP address on which RabbitMQ will listen for AMQP
|
||||||
|
connections. Set to the empty string to listen on all
|
||||||
|
interfaces. Note that RabbitMQ creates a user named
|
||||||
|
<literal>guest</literal> with password
|
||||||
|
<literal>guest</literal> by default, so you should delete
|
||||||
|
this user if you intend to allow external access.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.rabbitmq_server ];
|
||||||
|
|
||||||
|
users.extraUsers = singleton
|
||||||
|
{ name = "rabbitmq";
|
||||||
|
description = "RabbitMQ server user";
|
||||||
|
home = "/var/empty";
|
||||||
|
};
|
||||||
|
|
||||||
|
jobs.rabbitmq = {
|
||||||
|
description = "RabbitMQ server";
|
||||||
|
|
||||||
|
startOn = "started network-interfaces";
|
||||||
|
|
||||||
|
preStart =
|
||||||
|
''
|
||||||
|
mkdir -m 0700 -p /var/lib/rabbitmq
|
||||||
|
chown rabbitmq /var/lib/rabbitmq
|
||||||
|
|
||||||
|
mkdir -m 0700 -p /var/log/rabbitmq
|
||||||
|
chown rabbitmq /var/log/rabbitmq
|
||||||
|
'';
|
||||||
|
|
||||||
|
environment.HOME = "/var/lib/rabbitmq";
|
||||||
|
environment.RABBITMQ_NODE_IP_ADDRESS = cfg.listenAddress;
|
||||||
|
|
||||||
|
exec =
|
||||||
|
''
|
||||||
|
${run "${pkgs.rabbitmq_server}/sbin/rabbitmq-server"}
|
||||||
|
'';
|
||||||
|
|
||||||
|
preStop =
|
||||||
|
''
|
||||||
|
${run "${pkgs.rabbitmq_server}/sbin/rabbitmqctl stop"}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue