From af1c54fbdc92a687d00bc42b47fc5a6b0cf093d7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 19 Dec 2006 01:03:15 +0000 Subject: [PATCH] * Subversion subservice. * Example of a NixOS configuration for a Subversion server. svn path=/nixos/trunk/; revision=7412 --- configuration/options.nix | 31 +++++++++++++++++++ instances/examples/svn-server.nix | 33 ++++++++++++++++++++ upstart-jobs/httpd.nix | 50 +++++++++++++++++++++++++------ 3 files changed, 105 insertions(+), 9 deletions(-) create mode 100644 instances/examples/svn-server.nix diff --git a/configuration/options.nix b/configuration/options.nix index fa05d544307..4ed40d97a1f 100644 --- a/configuration/options.nix +++ b/configuration/options.nix @@ -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. + "; + } + + ] diff --git a/instances/examples/svn-server.nix b/instances/examples/svn-server.nix new file mode 100644 index 00000000000..33006d7edd6 --- /dev/null +++ b/instances/examples/svn-server.nix @@ -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"; + }; + + }; + + }; + + }; + +} diff --git a/upstart-jobs/httpd.nix b/upstart-jobs/httpd.nix index 4167343b6ad..6a0f7daa372 100644 --- a/upstart-jobs/httpd.nix +++ b/upstart-jobs/httpd.nix @@ -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 user group; + inherit hostName httpPort httpsPort + user group adminAddr logDir stateDir; - adminAddr = getCfg "adminAddr"; + subServices = + + # 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"; + + inherit logDir adminAddr; + + canonicalName = + if webServer.enableSSL then + "https://" + hostName + ":" + (toString httpsPort) + else + "http://" + hostName + ":" + (toString httpPort); - logDir = getCfg "logDir"; - stateDir = getCfg "stateDir"; + notificationSender = getCfgSvn "notificationSender"; + autoVersioning = getCfgSvn "autoVersioning"; - subServices = []; + inherit pkgs; + }) + + ; }; + in {