forked from mirrors/nixpkgs
* Subversion subservice.
* Example of a NixOS configuration for a Subversion server. svn path=/nixos/trunk/; revision=7412
This commit is contained in:
parent
9f47929138
commit
af1c54fbdc
|
@ -292,4 +292,35 @@
|
|||
}
|
||||
|
||||
|
||||
{
|
||||
name = ["services" "httpd" "subservices" "subversion" "enable"];
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the Subversion subservice in the webserver.
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
name = ["services" "httpd" "subservices" "subversion" "notificationSender"];
|
||||
example = "svn-server@example.org";
|
||||
description = "
|
||||
The email address used in the Sender field of commit
|
||||
notification messages sent by the Subversion subservice.
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
name = ["services" "httpd" "subservices" "subversion" "autoVersioning"];
|
||||
default = false;
|
||||
description = "
|
||||
Whether you want the Subversion subservice to support
|
||||
auto-versioning, which enables Subversion repositories to be
|
||||
mounted as read/writable file systems on operating systems that
|
||||
support WebDAV.
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
|
33
instances/examples/svn-server.nix
Normal file
33
instances/examples/svn-server.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
boot = {
|
||||
autoDetectRootDevice = false;
|
||||
rootDevice = "/dev/hda1";
|
||||
readOnlyRoot = false;
|
||||
grubDevice = "/dev/hda";
|
||||
};
|
||||
|
||||
services = {
|
||||
|
||||
sshd = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
httpd = {
|
||||
enable = true;
|
||||
adminAddr = "admin@example.org";
|
||||
|
||||
subservices = {
|
||||
|
||||
subversion = {
|
||||
enable = true;
|
||||
dataDir = "/data/subversion";
|
||||
notificationSender = "svn@example.org";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
|
@ -3,28 +3,60 @@
|
|||
let
|
||||
|
||||
getCfg = option: config.get ["services" "httpd" option];
|
||||
getCfgSvn = option: config.get ["services" "httpd" "subservices" "subversion" option];
|
||||
|
||||
optional = conf: subService:
|
||||
if conf then [subService] else [];
|
||||
|
||||
|
||||
hostName = getCfg "hostName";
|
||||
httpPort = getCfg "httpPort";
|
||||
httpsPort = getCfg "httpsPort";
|
||||
user = getCfg "user";
|
||||
group = getCfg "group";
|
||||
adminAddr = getCfg "adminAddr";
|
||||
logDir = getCfg "logDir";
|
||||
stateDir = getCfg "stateDir";
|
||||
enableSSL = false;
|
||||
|
||||
|
||||
webServer = import ../services/apache-httpd {
|
||||
inherit (pkgs) apacheHttpd coreutils;
|
||||
stdenv = pkgs.stdenvNew;
|
||||
|
||||
hostName = getCfg "hostName";
|
||||
httpPort = getCfg "httpPort";
|
||||
httpsPort = getCfg "httpsPort";
|
||||
inherit hostName httpPort httpsPort
|
||||
user group adminAddr logDir stateDir;
|
||||
|
||||
inherit user group;
|
||||
subServices =
|
||||
|
||||
adminAddr = getCfg "adminAddr";
|
||||
# The Subversion subservice.
|
||||
optional (getCfgSvn "enable") (
|
||||
let dataDir = getCfgSvn "dataDir"; in
|
||||
import ../services/subversion {
|
||||
reposDir = dataDir + "/repos";
|
||||
dbDir = dataDir + "/db";
|
||||
distsDir = dataDir + "/dist";
|
||||
backupsDir = dataDir + "/backup";
|
||||
tmpDir = dataDir + "/tmp";
|
||||
|
||||
logDir = getCfg "logDir";
|
||||
stateDir = getCfg "stateDir";
|
||||
inherit logDir adminAddr;
|
||||
|
||||
subServices = [];
|
||||
canonicalName =
|
||||
if webServer.enableSSL then
|
||||
"https://" + hostName + ":" + (toString httpsPort)
|
||||
else
|
||||
"http://" + hostName + ":" + (toString httpPort);
|
||||
|
||||
notificationSender = getCfgSvn "notificationSender";
|
||||
autoVersioning = getCfgSvn "autoVersioning";
|
||||
|
||||
inherit pkgs;
|
||||
})
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue