nixpkgs/pkgs/applications/version-management/gitlab/default.nix
Jaka Hudoklin 90683792aa gitlab: fix i686-linux build and module
It turns out that installing therubytracer, with dependency on old v8, even
when using source libv8 version is problematic.
(see
http://stackoverflow.com/questions/21666379/problems-installing-gitlab-on-odroid-v8-lib-not-available).

But wait, rails does not even need therubytracer, just any kind of javascript
server side execution framework like nodejs. Well just use that, as also
suggested from different internet sources (look link above), it works just
fine.
2014-12-14 02:24:12 +01:00

88 lines
2.9 KiB
Nix

{ 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 }:
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
postgresql libxslt libxml2 pkgconfig libffi icu checkinstall logrotate docutils nodejs
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)}
cp ${./Gemfile.lock} Gemfile.lock
substituteInPlace Gemfile --replace 'gem "therubyracer"' ""
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
# 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"
# 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;
};
}