1 # Subversion {#module-services-subversion}
3 [Subversion](https://subversion.apache.org/) is a centralized
4 version-control system. It can use a [variety of
5 protocols](https://svnbook.red-bean.com/en/1.7/svn-book.html#svn.serverconfig.choosing)
6 for communication between client and server.
8 ## Subversion inside Apache HTTP {#module-services-subversion-apache-httpd}
10 This section focuses on configuring a web-based server on top of the
11 Apache HTTP server, which uses
12 [WebDAV](http://www.webdav.org/)/[DeltaV](http://www.webdav.org/deltav/WWW10/deltav-intro.htm)
15 For more information on the general setup, please refer to the [the
16 appropriate section of the Subversion
17 book](https://svnbook.red-bean.com/en/1.7/svn-book.html#svn.serverconfig.httpd).
19 To configure, include in `/etc/nixos/configuration.nix` code to activate
20 Apache HTTP, setting [](#opt-services.httpd.adminAddr)
25 services.httpd.enable = true;
26 services.httpd.adminAddr = "...";
27 networking.firewall.allowedTCPPorts = [ 80 443 ];
31 For a simple Subversion server with basic authentication, configure the
32 Subversion module for Apache as follows, setting `hostName` and
33 `documentRoot` appropriately, and `SVNParentPath` to the parent
34 directory of the repositories, `AuthzSVNAccessFile` to the location of
35 the `.authz` file describing access permission, and `AuthUserFile` to
40 services.httpd.extraModules = [
41 # note that order is *super* important here
42 { name = "dav_svn"; path = "${pkgs.apacheHttpdPackages.subversion}/modules/mod_dav_svn.so"; }
43 { name = "authz_svn"; path = "${pkgs.apacheHttpdPackages.subversion}/modules/mod_authz_svn.so"; }
45 services.httpd.virtualHosts = {
48 documentRoot = DOCUMENTROOT;
49 locations."/svn".extraConfig = ''
51 SVNParentPath REPO_PARENT
52 AuthzSVNAccessFile ACCESS_FILE
53 AuthName "SVN Repositories"
55 AuthUserFile PASSWORD_FILE
63 The key `"svn"` is just a symbolic name identifying the virtual host.
64 The `"/svn"` in `locations."/svn".extraConfig` is the path underneath
65 which the repositories will be served.
67 [This page](https://wiki.archlinux.org/index.php/Subversion) explains
68 how to set up the Subversion configuration itself. This boils down to
71 Underneath `REPO_PARENT` repositories can be set up as follows:
74 $ svn create REPO_NAME
77 Repository files need to be accessible by `wwwrun`:
80 $ chown -R wwwrun:wwwrun REPO_PARENT
83 The password file `PASSWORD_FILE` can be created as follows:
86 $ htpasswd -cs PASSWORD_FILE USER_NAME
89 Additional users can be set up similarly, omitting the `c` flag:
92 $ htpasswd -s PASSWORD_FILE USER_NAME
95 The file describing access permissions `ACCESS_FILE` will look something
106 The Subversion repositories will be accessible as
107 `http://HOSTNAME/svn/REPO_NAME`.