at v192 76 lines 1.9 kB view raw
1{ stdenv, lib, bundler, fetchgit, bundlerEnv, defaultGemConfig, libiconv, ruby 2, tzdata, git 3}: 4 5let 6 gitlab = fetchgit { 7 url = "https://github.com/gitlabhq/gitlabhq.git"; 8 rev = "477743a154e85c411e8a533980abce460b5669fc"; 9 fetchSubmodules = false; 10 sha256 = "1gk77j886w6zvw5cawpgja6f87qirmjx7y4g5i3psxm4j67llxdp"; 11 }; 12 13 env = bundlerEnv { 14 name = "gitlab"; 15 inherit ruby; 16 gemfile = ./Gemfile; 17 lockfile = ./Gemfile.lock; 18 gemset = ./gemset.nix; 19 meta = with lib; { 20 homepage = http://www.gitlab.com/; 21 platforms = platforms.linux; 22 maintainers = [ ]; 23 license = licenses.mit; 24 }; 25 }; 26 27in 28 29stdenv.mkDerivation rec { 30 name = "gitlab-${version}"; 31 version = "7.4.2"; 32 buildInputs = [ ruby bundler tzdata git ]; 33 unpackPhase = '' 34 runHook preUnpack 35 cp -r ${gitlab}/* . 36 chmod -R +w . 37 cp ${./Gemfile} Gemfile 38 cp ${./Gemfile.lock} Gemfile.lock 39 runHook postUnpack 40 ''; 41 patches = [ 42 ./remove-hardcoded-locations.patch 43 ]; 44 postPatch = '' 45 # For reasons I don't understand "bundle exec" ignores the 46 # RAILS_ENV causing tests to be executed that fail because we're 47 # not installing development and test gems above. Deleting the 48 # tests works though.: 49 rm lib/tasks/test.rake 50 51 mv config/gitlab.yml.example config/gitlab.yml 52 53 # required for some gems: 54 cat > config/database.yml <<EOF 55 production: 56 adapter: postgresql 57 database: gitlab 58 host: <%= ENV["GITLAB_DATABASE_HOST"] || "127.0.0.1" %> 59 password: <%= ENV["GITLAB_DATABASE_PASSWORD"] || "blerg" %> 60 username: gitlab 61 encoding: utf8 62 EOF 63 ''; 64 buildPhase = '' 65 export GEM_HOME=${env}/${ruby.gemPath} 66 bundle exec rake assets:precompile RAILS_ENV=production 67 ''; 68 installPhase = '' 69 mkdir -p $out/share 70 cp -r . $out/share/gitlab 71 ''; 72 passthru = { 73 inherit env; 74 inherit ruby; 75 }; 76}