2015-01-25 21:01:48 +00:00
|
|
|
{ stdenv, lib, bundler, fetchgit, bundlerEnv, defaultGemConfig, libiconv, ruby
|
|
|
|
, tzdata, git
|
|
|
|
}:
|
2014-10-25 16:22:49 +00:00
|
|
|
|
|
|
|
let
|
2015-01-25 21:01:48 +00:00
|
|
|
gitlab = fetchgit {
|
|
|
|
url = "https://github.com/gitlabhq/gitlabhq.git";
|
|
|
|
rev = "477743a154e85c411e8a533980abce460b5669fc";
|
|
|
|
fetchSubmodules = false;
|
2015-02-18 16:25:13 +00:00
|
|
|
sha256 = "1gk77j886w6zvw5cawpgja6f87qirmjx7y4g5i3psxm4j67llxdp";
|
2014-10-25 16:22:49 +00:00
|
|
|
};
|
|
|
|
|
2015-01-25 21:01:48 +00:00
|
|
|
env = bundlerEnv {
|
|
|
|
name = "gitlab";
|
|
|
|
inherit ruby;
|
|
|
|
gemfile = ./Gemfile;
|
|
|
|
lockfile = ./Gemfile.lock;
|
|
|
|
gemset = ./gemset.nix;
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = http://www.gitlab.com/;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ ];
|
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
};
|
2014-10-25 16:22:49 +00:00
|
|
|
|
2015-01-25 21:01:48 +00:00
|
|
|
in
|
2014-10-25 16:22:49 +00:00
|
|
|
|
2015-01-25 21:01:48 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "gitlab-${version}";
|
|
|
|
version = "7.4.2";
|
|
|
|
buildInputs = [ ruby bundler tzdata git ];
|
|
|
|
unpackPhase = ''
|
|
|
|
runHook preUnpack
|
|
|
|
cp -r ${gitlab}/* .
|
|
|
|
chmod -R +w .
|
|
|
|
cp ${./Gemfile} Gemfile
|
|
|
|
cp ${./Gemfile.lock} Gemfile.lock
|
|
|
|
runHook postUnpack
|
|
|
|
'';
|
2014-10-25 16:22:49 +00:00
|
|
|
patches = [
|
|
|
|
./remove-hardcoded-locations.patch
|
|
|
|
];
|
|
|
|
postPatch = ''
|
2015-01-25 21:01:48 +00:00
|
|
|
# For reasons I don't understand "bundle exec" ignores the
|
|
|
|
# RAILS_ENV causing tests to be executed that fail because we're
|
|
|
|
# not installing development and test gems above. Deleting the
|
|
|
|
# tests works though.:
|
|
|
|
rm lib/tasks/test.rake
|
2014-10-25 16:22:49 +00:00
|
|
|
|
2015-01-25 21:01:48 +00:00
|
|
|
mv config/gitlab.yml.example config/gitlab.yml
|
2014-10-25 16:22:49 +00:00
|
|
|
|
|
|
|
# required for some gems:
|
|
|
|
cat > config/database.yml <<EOF
|
|
|
|
production:
|
|
|
|
adapter: postgresql
|
|
|
|
database: gitlab
|
|
|
|
host: <%= ENV["GITLAB_DATABASE_HOST"] || "127.0.0.1" %>
|
|
|
|
password: <%= ENV["GITLAB_DATABASE_PASSWORD"] || "blerg" %>
|
|
|
|
username: gitlab
|
|
|
|
encoding: utf8
|
|
|
|
EOF
|
2015-01-25 21:01:48 +00:00
|
|
|
'';
|
|
|
|
buildPhase = ''
|
|
|
|
export GEM_HOME=${env}/${ruby.gemPath}
|
2014-10-25 16:22:49 +00:00
|
|
|
bundle exec rake assets:precompile RAILS_ENV=production
|
|
|
|
'';
|
2015-01-25 21:01:48 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/share
|
|
|
|
cp -r . $out/share/gitlab
|
|
|
|
'';
|
|
|
|
passthru = {
|
|
|
|
inherit env;
|
|
|
|
inherit ruby;
|
2014-10-25 16:22:49 +00:00
|
|
|
};
|
|
|
|
}
|