about summary refs log tree commit diff
path: root/pkgs/applications/version-management/gitlab/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/version-management/gitlab/default.nix')
-rw-r--r--pkgs/applications/version-management/gitlab/default.nix34
1 files changed, 24 insertions, 10 deletions
diff --git a/pkgs/applications/version-management/gitlab/default.nix b/pkgs/applications/version-management/gitlab/default.nix
index 8af64ce78e92..5f9983674308 100644
--- a/pkgs/applications/version-management/gitlab/default.nix
+++ b/pkgs/applications/version-management/gitlab/default.nix
@@ -1,7 +1,10 @@
-{ stdenv, lib, bundler, fetchgit, bundlerEnv, defaultGemConfig, libiconv, ruby
+{ stdenv, lib, bundler, fetchFromGitHub, bundlerEnv, defaultGemConfig, libiconv, ruby
 , tzdata, git, nodejs, procps
 }:
 
+/* When updating the Gemfile add `gem "activerecord-nulldb-adapter"`
+   to allow building the assets without a database */
+
 let
   env = bundlerEnv {
     name = "gitlab";
@@ -21,19 +24,23 @@ in
 
 stdenv.mkDerivation rec {
   name = "gitlab-${version}";
-  version = "8.0.5";
+  version = "8.5.1";
+
   buildInputs = [ ruby bundler tzdata git nodejs procps ];
-  src = fetchgit {
-    url = "https://github.com/gitlabhq/gitlabhq.git";
-    rev = "2866c501b5a5abb69d101cc07261a1d684b4bd4c";
-    fetchSubmodules = false;
-    sha256 = "edc6bedd5e79940189355d8cb343d20b0781b69fcef56ccae5906fa5e81ed521";
+
+  src = fetchFromGitHub {
+    owner = "gitlabhq";
+    repo = "gitlabhq";
+    rev = "v${version}";
+    sha256 = "1pn5r4axzjkgdjr59y3wgxsd2n83zfd5bry1g2w4c2qw0wcw7zqb";
   };
 
   patches = [
     ./remove-hardcoded-locations.patch
     ./disable-dump-schema-after-migration.patch
+    ./nulladapter.patch
   ];
+
   postPatch = ''
     # For reasons I don't understand "bundle exec" ignores the
     # RAILS_ENV causing tests to be executed that fail because we're
@@ -41,7 +48,6 @@ stdenv.mkDerivation rec {
     # tests works though.:
     rm lib/tasks/test.rake
 
-    mv config/gitlab.yml.example config/gitlab.yml
     rm config/initializers/gitlab_shell_secret_token.rb
 
     substituteInPlace app/controllers/admin/background_jobs_controller.rb \
@@ -50,7 +56,7 @@ stdenv.mkDerivation rec {
     # required for some gems:
     cat > config/database.yml <<EOF
       production:
-        adapter: postgresql
+        adapter: <%= ENV["GITLAB_DATABASE_ADAPTER"] || sqlite %>
         database: gitlab
         host: <%= ENV["GITLAB_DATABASE_HOST"] || "127.0.0.1" %>
         password: <%= ENV["GITLAB_DATABASE_PASSWORD"] || "blerg" %>
@@ -58,14 +64,22 @@ stdenv.mkDerivation rec {
         encoding: utf8
     EOF
   '';
+
   buildPhase = ''
     export GEM_HOME=${env}/${ruby.gemPath}
-    bundle exec rake assets:precompile RAILS_ENV=production
+    mv config/gitlab.yml.example config/gitlab.yml
+    GITLAB_DATABASE_ADAPTER=nulldb bundle exec rake assets:precompile RAILS_ENV=production
+    mv config/gitlab.yml config/gitlab.yml.example
+    mv config config.dist
   '';
+
   installPhase = ''
     mkdir -p $out/share
     cp -r . $out/share/gitlab
+    ln -sf /run/gitlab/uploads $out/share/gitlab/public/uploads
+    ln -sf /run/gitlab/config $out/share/gitlab/config
   '';
+
   passthru = {
     inherit env;
     inherit ruby;