summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorAustin Seipp <aseipp@pobox.com>2014-05-14 14:57:36 -0500
committerAustin Seipp <aseipp@pobox.com>2014-05-14 14:57:36 -0500
commit2558fa587bd1d71de5de089df1bbcff5b0254c03 (patch)
treead4a706a5d0b75fcc4cbf4c36e77fa49f8890d71 /nixos
parentaaf7f570c16bbffcb8d556bfd41365e908554847 (diff)
parent25e0d51a6793a5773227bda92ae494b73c8df624 (diff)
downloadnixlib-2558fa587bd1d71de5de089df1bbcff5b0254c03.tar
nixlib-2558fa587bd1d71de5de089df1bbcff5b0254c03.tar.gz
nixlib-2558fa587bd1d71de5de089df1bbcff5b0254c03.tar.bz2
nixlib-2558fa587bd1d71de5de089df1bbcff5b0254c03.tar.lz
nixlib-2558fa587bd1d71de5de089df1bbcff5b0254c03.tar.xz
nixlib-2558fa587bd1d71de5de089df1bbcff5b0254c03.tar.zst
nixlib-2558fa587bd1d71de5de089df1bbcff5b0254c03.zip
Merge pull request #2629 from letac/master
Phabricator, a web application, snapshot of 2014-05-12
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/phabricator.nix41
-rw-r--r--nixos/tests/phabricator.nix66
2 files changed, 107 insertions, 0 deletions
diff --git a/nixos/modules/services/web-servers/apache-httpd/phabricator.nix b/nixos/modules/services/web-servers/apache-httpd/phabricator.nix
new file mode 100644
index 000000000000..c7a9bdf68c56
--- /dev/null
+++ b/nixos/modules/services/web-servers/apache-httpd/phabricator.nix
@@ -0,0 +1,41 @@
+{ config, lib, pkgs, ... }:
+let
+  phabricatorRoot = pkgs.stdenv.mkDerivation rec {
+    version = "2014-05-12";
+    name = "phabricator-${version}";
+    srcLibphutil = pkgs.fetchgit {
+        url = git://github.com/facebook/libphutil.git;
+        rev = "2f3b5a1cf6ea464a0250d4b1c653a795a90d2716";
+        sha256 = "9598cec400984dc149162f1e648814a54ea0cd34fcd529973dc83f5486fdd9fd";
+    };
+    srcArcanist = pkgs.fetchgit {
+        url = git://github.com/facebook/arcanist.git;
+        rev = "54c377448db8dbc40f0ca86d43c837d30e493485";
+        sha256 = "086db3c0d1154fbad23e7c6def31fd913384ee20247b329515838b669c3028e0";
+    };
+    srcPhabricator = pkgs.fetchgit {
+        url = git://github.com/facebook/phabricator.git;
+        rev = "1644ef185ecf1e9fca3eb6b16351ef46b19d110f";
+        sha256 = "e1135e4ba76d53f48aad4161563035414ed7e878f39a8a34a875a01b41b2a084";
+    };
+    
+    buildCommand = ''
+      mkdir -p $out
+      cp -R ${srcLibphutil} $out/libphutil
+      cp -R ${srcArcanist} $out/arcanist
+      cp -R ${srcPhabricator} $out/phabricator
+    '';
+  };
+in {
+  enablePHP = true;
+  extraApacheModules = [ "mod_rewrite" ];
+  DocumentRoot = "${phabricatorRoot}/phabricator/webroot";
+  extraConfig = ''
+      DocumentRoot ${phabricatorRoot}/phabricator/webroot
+
+      RewriteEngine on
+      RewriteRule ^/rsrc/(.*) - [L,QSA]
+      RewriteRule ^/favicon.ico - [L,QSA]
+      RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
+  '';
+}
diff --git a/nixos/tests/phabricator.nix b/nixos/tests/phabricator.nix
new file mode 100644
index 000000000000..8a8c6cb784cc
--- /dev/null
+++ b/nixos/tests/phabricator.nix
@@ -0,0 +1,66 @@
+import ./make-test.nix ({ pkgs, ... }: {
+
+  nodes = {
+    storage =
+      { config, pkgs, ... }:
+      { services.nfs.server.enable = true;
+        services.nfs.server.exports = ''
+          /repos 192.168.1.0/255.255.255.0(rw,no_root_squash)
+        '';
+        services.nfs.server.createMountPoints = true;
+      };
+
+    webserver =
+      { config, pkgs, ... }:
+      { fileSystems = pkgs.lib.mkVMOverride
+          [ { mountPoint = "/repos";
+              device = "storage:/repos";
+              fsType = "nfs";
+            }
+          ];
+        networking.firewall.enable = false;
+        networking.useDHCP = false;
+
+        services = {
+          httpd = {
+            enable = true;
+            adminAddr = "root@localhost";
+            virtualHosts = [{
+              hostName = "phabricator.local";
+              extraSubservices = [{serviceType = "phabricator";}];
+            }];
+          };
+
+          mysql = {
+            enable = true;
+            package = pkgs.mysql;
+          };
+        };
+
+        environment.systemPackages = [ pkgs.php ];
+      };
+
+    client =
+      { config, pkgs, ... }:
+      { imports = [ ./common/x11.nix ];
+        services.xserver.desktopManager.kde4.enable = true;
+      };
+  };
+
+  testScript =
+    ''
+      startAll;
+
+      $client->waitForX;
+
+      $webserver->waitForUnit("mysql");
+      $webserver->waitForUnit("httpd");
+      $webserver->execute("cd /nix/store; less >/repos/log1");
+
+      $client->sleep(30); # loading takes a long time
+      $client->execute("konqueror http://webserver/ &");
+      $client->sleep(90); # loading takes a long time
+
+      $client->screenshot("screen");
+    '';
+})