2014-12-14 01:24:12 +00:00
|
|
|
{ stdenv, fetchurl, ruby, rubyLibs, libiconv, libxslt, libxml2, pkgconfig, libffi, postgresql, libyaml, ncurses, curl, openssh, redis, zlib, icu, checkinstall, logrotate, docutils, cmake, git, gdbm, readline, unzip, gnumake, which, tzdata, nodejs }:
|
2014-10-25 16:22:49 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
gemspec = map (gem: fetchurl { url=gem.url; sha256=gem.hash; }) (import ./Gemfile.nix);
|
|
|
|
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
version = "7.4.2";
|
|
|
|
name = "gitlab-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/gitlabhq/gitlabhq/archive/v${version}.zip";
|
|
|
|
sha256 = "01iplkpa4scr0wcap6vjrc960dj15z4ciclaqswj0sz5hrp9glw6";
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
ruby rubyLibs.bundler libyaml gdbm readline ncurses curl openssh redis zlib
|
2014-12-14 01:24:12 +00:00
|
|
|
postgresql libxslt libxml2 pkgconfig libffi icu checkinstall logrotate docutils nodejs
|
2014-10-25 16:22:49 +00:00
|
|
|
git unzip gnumake which cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
# cmake is required by a build depdenceny, not the main binary:
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./remove-hardcoded-locations.patch
|
|
|
|
];
|
|
|
|
postPatch = ''
|
|
|
|
mv config/gitlab.yml.example config/gitlab.yml
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/share/gitlab
|
|
|
|
cp -R . $out/share/gitlab
|
|
|
|
cd $out/share/gitlab
|
|
|
|
|
|
|
|
export HOME=$(pwd)
|
|
|
|
export GITLAB_EMAIL_FROM="required@to-make-it-work.org"
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
mkdir -p vendor/cache
|
|
|
|
${stdenv.lib.concatStrings (map (gem: "ln -s ${gem} vendor/cache/${gem.name};") gemspec)}
|
|
|
|
|
2014-12-14 01:24:12 +00:00
|
|
|
cp ${./Gemfile.lock} Gemfile.lock
|
|
|
|
substituteInPlace Gemfile --replace 'gem "therubyracer"' ""
|
|
|
|
|
2014-10-25 16:22:49 +00:00
|
|
|
bundle config build.nokogiri \
|
|
|
|
--use-system-libraries \
|
|
|
|
--with-xslt-dir=${libxslt} \
|
|
|
|
--with-xml2-dir=${libxml2} \
|
|
|
|
--with-pkg-config=${pkgconfig}/bin/pkg-config \
|
|
|
|
--with-pg-config=${postgresql}/bin/pg_config
|
|
|
|
|
|
|
|
# See https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide:
|
|
|
|
bundle install -j4 --verbose --local --deployment --without development test mysql
|
|
|
|
|
2014-11-29 23:56:22 +00:00
|
|
|
# Fix timezone data directory
|
|
|
|
substituteInPlace $out/share/gitlab/vendor/bundle/ruby/*/gems/tzinfo-*/lib/tzinfo/zoneinfo_data_source.rb \
|
|
|
|
--replace "/etc/zoneinfo" "${tzdata}/share/zoneinfo"
|
|
|
|
|
2014-10-25 16:22:49 +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 $out/share/gitlab/lib/tasks/test.rake
|
|
|
|
|
|
|
|
# Assets
|
|
|
|
bundle exec rake assets:precompile RAILS_ENV=production
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://www.gitlab.com/;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ ];
|
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|