summary refs log tree commit diff
path: root/pkgs/applications/version-management/redmine/bootstrap.nix
blob: 53757c37ed8207e6366df58ea51db6b6d7347c31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ pkgs ? import <nixpkgs> {}
}:

with pkgs;

let

in stdenv.mkDerivation rec {
  version = "2.5.2";
  name = "redmine-${version}";
  __noChroot = true;
  src = fetchurl {
    url = "http://www.redmine.org/releases/${name}.tar.gz";
    sha256 = "0x0zwxyj4dwbk7l64s3lgny10mjf0ba8jwrbafsm4d72sncmacv0";
  };

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [
    ruby bundler libiconv libxslt libxml2
    libffi imagemagickBig postgresql which stdenv
  ];
  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.out} \
      --with-xml2-dir=${libxml2.out} \
      --with-pkg-config \
      --with-pg-config=${postgresql}/bin/pg_config

    bundle install --verbose --without development test rmagick --path /tmp/redmine-${version}

    HOME="/tmp/redmine-${version}" ruby generate_nix_requirements.rb
    rm -R /tmp/gems
  '';
}