Adding a module for the prayer webmail.
svn path=/nixos/trunk/; revision=30361
This commit is contained in:
parent
0302e2cc57
commit
578f83eef4
|
@ -67,6 +67,7 @@ in
|
||||||
dovecot2 = 46;
|
dovecot2 = 46;
|
||||||
dovenull2 = 47;
|
dovenull2 = 47;
|
||||||
unbound = 48;
|
unbound = 48;
|
||||||
|
prayer = 49;
|
||||||
|
|
||||||
# When adding a uid, make sure it doesn't match an existing gid.
|
# When adding a uid, make sure it doesn't match an existing gid.
|
||||||
|
|
||||||
|
@ -114,6 +115,7 @@ in
|
||||||
fourStoreEndpoint = 43;
|
fourStoreEndpoint = 43;
|
||||||
virtuoso = 44;
|
virtuoso = 44;
|
||||||
dovecot2 = 45;
|
dovecot2 = 45;
|
||||||
|
prayer = 46;
|
||||||
|
|
||||||
# When adding a gid, make sure it doesn't match an existing uid.
|
# When adding a gid, make sure it doesn't match an existing uid.
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,7 @@
|
||||||
./services/networking/openfire.nix
|
./services/networking/openfire.nix
|
||||||
./services/networking/openvpn.nix
|
./services/networking/openvpn.nix
|
||||||
./services/networking/portmap.nix
|
./services/networking/portmap.nix
|
||||||
|
./services/networking/prayer.nix
|
||||||
./services/networking/privoxy.nix
|
./services/networking/privoxy.nix
|
||||||
./services/networking/quassel.nix
|
./services/networking/quassel.nix
|
||||||
./services/networking/radvd.nix
|
./services/networking/radvd.nix
|
||||||
|
|
104
modules/services/networking/prayer.nix
Normal file
104
modules/services/networking/prayer.nix
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inherit (pkgs) prayer;
|
||||||
|
|
||||||
|
stateDir = "/var/lib/prayer";
|
||||||
|
|
||||||
|
prayerUser = "prayer";
|
||||||
|
prayerGroup = "prayer";
|
||||||
|
|
||||||
|
prayerExtraCfg = pkgs.writeText "extraprayer.cf" ''
|
||||||
|
prefix = "${prayer}"
|
||||||
|
var_prefix = "${stateDir}"
|
||||||
|
prayer_user = "${prayerUser}"
|
||||||
|
prayer_group = "${prayerGroup}"
|
||||||
|
sendmail_path = "/var/setuid-wrappers/sendmail"
|
||||||
|
|
||||||
|
${config.services.prayer.extraConfig}
|
||||||
|
'';
|
||||||
|
|
||||||
|
prayerCfg = pkgs.runCommand "prayer.cf" { } ''
|
||||||
|
cat ${prayer}/etc/prayer.cf ${prayerExtraCfg} > $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.prayer = {
|
||||||
|
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to run the machine as a HTTP proxy server.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
listenAddress = mkOption {
|
||||||
|
default = "127.0.0.1:8118";
|
||||||
|
description = ''
|
||||||
|
Address the proxy server is listening to.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
logDir = mkOption {
|
||||||
|
default = "/var/log/prayer" ;
|
||||||
|
description = ''
|
||||||
|
Location for prayer log files.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = mkOption {
|
||||||
|
default = "" ;
|
||||||
|
description = ''
|
||||||
|
Extra configuration. Contents will be added verbatim to the configuration file.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
|
||||||
|
config = mkIf config.services.prayer.enable {
|
||||||
|
environment.systemPackages = [ prayer ];
|
||||||
|
|
||||||
|
users.extraUsers = singleton
|
||||||
|
{ name = prayerUser;
|
||||||
|
uid = config.ids.uids.prayer;
|
||||||
|
description = "prayer daemon user";
|
||||||
|
home = stateDir;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.extraGroups = singleton
|
||||||
|
{ name = prayerGroup;
|
||||||
|
gid = config.ids.gids.prayer;
|
||||||
|
};
|
||||||
|
|
||||||
|
jobs.prayer =
|
||||||
|
{ name = "prayer";
|
||||||
|
|
||||||
|
startOn = "startup";
|
||||||
|
|
||||||
|
preStart =
|
||||||
|
''
|
||||||
|
mkdir -m 0755 -p ${stateDir}
|
||||||
|
chown ${prayerUser}.${prayerGroup} ${stateDir}
|
||||||
|
'';
|
||||||
|
|
||||||
|
daemonType = "daemon";
|
||||||
|
|
||||||
|
exec = "${prayer}/sbin/prayer --config-file=${prayerCfg}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue