1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 phabricatorRoot = pkgs.phabricator;
7in {
8
9 enablePHP = true;
10 extraApacheModules = [ "mod_rewrite" ];
11 DocumentRoot = "${phabricatorRoot}/phabricator/webroot";
12
13 options = {
14 git = mkOption {
15 default = true;
16 description = "Enable git repositories.";
17 };
18 mercurial = mkOption {
19 default = true;
20 description = "Enable mercurial repositories.";
21 };
22 subversion = mkOption {
23 default = true;
24 description = "Enable subversion repositories.";
25 };
26 };
27
28 extraConfig = ''
29 DocumentRoot ${phabricatorRoot}/phabricator/webroot
30
31 RewriteEngine on
32 RewriteRule ^/rsrc/(.*) - [L,QSA]
33 RewriteRule ^/favicon.ico - [L,QSA]
34 RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
35 '';
36
37 extraServerPath = [
38 "${pkgs.which}"
39 "${pkgs.diffutils}"
40 ] ++
41 (if config.mercurial then ["${pkgs.mercurial}"] else []) ++
42 (if config.subversion then ["${pkgs.subversion.out}"] else []) ++
43 (if config.git then ["${pkgs.git}"] else []);
44
45 startupScript = pkgs.writeScript "activatePhabricator" ''
46 mkdir -p /var/repo
47 chown wwwrun /var/repo
48 '';
49
50}