nixpkgs/pkgs/applications/version-management/gitlab/bootstrap.nix
Thomas Hunger 59995e168c nixos: Add gitlab and gitlab-shell
I had to make several adjustments to make it work with nixos:

* Replace relative config file lookups with ENV variable.
* Modify gitlab-shell to not clear then environment when running
  pre-receive.
* Modify gitlab-shell to write some environment variables into
  the .authorized_keys file to make sure gitlab-shell reads the
  correct config file.
* Log unicorn output to syslog.
  I tried various ways of adding a syslog package but the bundler would
  not pick them up. Please fix in a better way if possible.
* Gitlab-runner program wrapper.
  This is useful to run e.g. backups etc. with the correct
  environment set up.
2014-12-12 18:01:29 +01:00

44 lines
1 KiB
Nix

{ pkgs ? import <nixpkgs> {}
}:
with pkgs;
let
in stdenv.mkDerivation rec {
version = "7.4.2";
name = "gitlab-${version}";
__noChroot = true;
src = fetchurl {
url = "https://github.com/gitlabhq/gitlabhq/archive/v${version}.zip";
sha256 = "01iplkpa4scr0wcap6vjrc960dj15z4ciclaqswj0sz5hrp9glw6";
};
buildInputs = [
ruby rubyLibs.bundler libiconv libxslt libxml2 pkgconfig
libffi postgresql which stdenv unzip
];
installPhase = ''
unset http_proxy
unset ftp_proxy
cp -R . $out
cp ${./generate_nix_requirements.rb} $out/generate_nix_requirements.rb
cd $out
cat > config/database.yml <<EOF
production:
adapter: postgresql
EOF
bundle config --local build.nokogiri --use-system-libraries \
--with-iconv-dir=${libiconv} \
--with-xslt-dir=${libxslt} \
--with-xml2-dir=${libxml2} \
--with-pkg-config \
--with-pg-config=${postgresql}/bin/pg_config
HOME="/tmp/gitlab-${version}" ruby generate_nix_requirements.rb
rm -R /tmp/gems
'';
}