gitlab: fix evaluation
This commit is contained in:
parent
989a894fc8
commit
6eaa419920
@ -7,8 +7,10 @@ with lib;
|
|||||||
let
|
let
|
||||||
cfg = config.services.gitlab;
|
cfg = config.services.gitlab;
|
||||||
|
|
||||||
ruby = pkgs.ruby;
|
ruby = pkgs.gitlab.ruby;
|
||||||
rubyLibs = pkgs.rubyLibs;
|
bundler = pkgs.bundler;
|
||||||
|
|
||||||
|
gemHome = "${pkgs.gitlab.env}/${ruby.gemPath}"
|
||||||
|
|
||||||
databaseYml = ''
|
databaseYml = ''
|
||||||
production:
|
production:
|
||||||
@ -38,13 +40,14 @@ let
|
|||||||
|
|
||||||
gitlab-runner = pkgs.stdenv.mkDerivation rec {
|
gitlab-runner = pkgs.stdenv.mkDerivation rec {
|
||||||
name = "gitlab-runner";
|
name = "gitlab-runner";
|
||||||
buildInputs = [ pkgs.gitlab pkgs.rubyLibs.bundler pkgs.makeWrapper ];
|
buildInputs = [ pkgs.gitlab pkgs.bundler pkgs.makeWrapper ];
|
||||||
phases = "installPhase fixupPhase";
|
phases = "installPhase fixupPhase";
|
||||||
buildPhase = "";
|
buildPhase = "";
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
makeWrapper ${rubyLibs.bundler}/bin/bundle $out/bin/gitlab-runner\
|
makeWrapper ${bundler}/bin/bundle $out/bin/gitlab-runner\
|
||||||
--set RAKEOPT '"-f ${pkgs.gitlab}/share/gitlab/Rakefile"'\
|
--set RAKEOPT '"-f ${pkgs.gitlab}/share/gitlab/Rakefile"'\
|
||||||
|
--set GEM_HOME '${gemHome}'\
|
||||||
--set UNICORN_PATH "${cfg.stateDir}/"\
|
--set UNICORN_PATH "${cfg.stateDir}/"\
|
||||||
--set GITLAB_PATH "${pkgs.gitlab}/share/gitlab/"\
|
--set GITLAB_PATH "${pkgs.gitlab}/share/gitlab/"\
|
||||||
--set GITLAB_APPLICATION_LOG_PATH "${cfg.stateDir}/log/application.log"\
|
--set GITLAB_APPLICATION_LOG_PATH "${cfg.stateDir}/log/application.log"\
|
||||||
@ -172,6 +175,7 @@ in {
|
|||||||
after = [ "network.target" "redis.service" ];
|
after = [ "network.target" "redis.service" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
environment.HOME = "${cfg.stateDir}/home";
|
environment.HOME = "${cfg.stateDir}/home";
|
||||||
|
environment.GEM_HOME = gemHome;
|
||||||
environment.UNICORN_PATH = "${cfg.stateDir}/";
|
environment.UNICORN_PATH = "${cfg.stateDir}/";
|
||||||
environment.GITLAB_PATH = "${pkgs.gitlab}/share/gitlab/";
|
environment.GITLAB_PATH = "${pkgs.gitlab}/share/gitlab/";
|
||||||
environment.GITLAB_APPLICATION_LOG_PATH = "${cfg.stateDir}/log/application.log";
|
environment.GITLAB_APPLICATION_LOG_PATH = "${cfg.stateDir}/log/application.log";
|
||||||
@ -201,7 +205,7 @@ in {
|
|||||||
Group = "gitlab";
|
Group = "gitlab";
|
||||||
TimeoutSec = "300";
|
TimeoutSec = "300";
|
||||||
WorkingDirectory = "${pkgs.gitlab}/share/gitlab";
|
WorkingDirectory = "${pkgs.gitlab}/share/gitlab";
|
||||||
ExecStart="${rubyLibs.bundler}/bin/bundle exec \"sidekiq -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e production -P ${cfg.stateDir}/tmp/sidekiq.pid\"";
|
ExecStart="${bundler}/bin/bundle exec \"sidekiq -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e production -P ${cfg.stateDir}/tmp/sidekiq.pid\"";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -209,6 +213,7 @@ in {
|
|||||||
after = [ "network.target" "postgresql.service" "redis.service" ];
|
after = [ "network.target" "postgresql.service" "redis.service" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
environment.HOME = "${cfg.stateDir}/home";
|
environment.HOME = "${cfg.stateDir}/home";
|
||||||
|
environment.GEM_HOME = gemHome;
|
||||||
environment.UNICORN_PATH = "${cfg.stateDir}/";
|
environment.UNICORN_PATH = "${cfg.stateDir}/";
|
||||||
environment.GITLAB_PATH = "${pkgs.gitlab}/share/gitlab/";
|
environment.GITLAB_PATH = "${pkgs.gitlab}/share/gitlab/";
|
||||||
environment.GITLAB_APPLICATION_LOG_PATH = "${cfg.stateDir}/log/application.log";
|
environment.GITLAB_APPLICATION_LOG_PATH = "${cfg.stateDir}/log/application.log";
|
||||||
@ -263,7 +268,7 @@ in {
|
|||||||
|
|
||||||
# force=yes disables the manual-interaction yes/no prompt
|
# force=yes disables the manual-interaction yes/no prompt
|
||||||
# which breaks without an stdin.
|
# which breaks without an stdin.
|
||||||
force=yes ${rubyLibs.bundler}/bin/bundle exec rake -f ${pkgs.gitlab}/share/gitlab/Rakefile gitlab:setup RAILS_ENV=production
|
force=yes ${bundler}/bin/bundle exec rake -f ${pkgs.gitlab}/share/gitlab/Rakefile gitlab:setup RAILS_ENV=production
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -285,7 +290,7 @@ in {
|
|||||||
Group = "gitlab";
|
Group = "gitlab";
|
||||||
TimeoutSec = "300";
|
TimeoutSec = "300";
|
||||||
WorkingDirectory = "${pkgs.gitlab}/share/gitlab";
|
WorkingDirectory = "${pkgs.gitlab}/share/gitlab";
|
||||||
ExecStart="${rubyLibs.bundler}/bin/bundle exec \"unicorn -c ${cfg.stateDir}/config/unicorn.rb -E production\"";
|
ExecStart="${bundler}/bin/bundle exec \"unicorn -c ${cfg.stateDir}/config/unicorn.rb -E production\"";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
258
pkgs/applications/version-management/gitlab/Gemfile
Normal file
258
pkgs/applications/version-management/gitlab/Gemfile
Normal file
@ -0,0 +1,258 @@
|
|||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
def darwin_only(require_as)
|
||||||
|
RUBY_PLATFORM.include?('darwin') && require_as
|
||||||
|
end
|
||||||
|
|
||||||
|
def linux_only(require_as)
|
||||||
|
RUBY_PLATFORM.include?('linux') && require_as
|
||||||
|
end
|
||||||
|
|
||||||
|
gem "rails", "~> 4.1.0"
|
||||||
|
|
||||||
|
# Make links from text
|
||||||
|
gem 'rails_autolink', '~> 1.1'
|
||||||
|
|
||||||
|
# Default values for AR models
|
||||||
|
gem "default_value_for", "~> 3.0.0"
|
||||||
|
|
||||||
|
# Supported DBs
|
||||||
|
gem "mysql2", group: :mysql
|
||||||
|
gem "pg", group: :postgres
|
||||||
|
|
||||||
|
# Auth
|
||||||
|
gem "devise", '3.2.4'
|
||||||
|
gem "devise-async", '0.9.0'
|
||||||
|
gem 'omniauth', "~> 1.1.3"
|
||||||
|
gem 'omniauth-google-oauth2'
|
||||||
|
gem 'omniauth-twitter'
|
||||||
|
gem 'omniauth-github'
|
||||||
|
gem 'omniauth-shibboleth'
|
||||||
|
|
||||||
|
# Extracting information from a git repository
|
||||||
|
# Provide access to Gitlab::Git library
|
||||||
|
gem "gitlab_git", '7.0.0.rc10'
|
||||||
|
|
||||||
|
# Ruby/Rack Git Smart-HTTP Server Handler
|
||||||
|
gem 'gitlab-grack', '~> 2.0.0.pre', require: 'grack'
|
||||||
|
|
||||||
|
# LDAP Auth
|
||||||
|
gem 'gitlab_omniauth-ldap', '1.1.0', require: "omniauth-ldap"
|
||||||
|
|
||||||
|
# Git Wiki
|
||||||
|
gem 'gollum-lib', '~> 3.0.0'
|
||||||
|
|
||||||
|
# Language detection
|
||||||
|
gem "gitlab-linguist", "~> 3.0.0", require: "linguist"
|
||||||
|
|
||||||
|
# API
|
||||||
|
gem "grape", "~> 0.6.1"
|
||||||
|
gem "grape-entity", "~> 0.4.2"
|
||||||
|
gem 'rack-cors', require: 'rack/cors'
|
||||||
|
|
||||||
|
# Format dates and times
|
||||||
|
# based on human-friendly examples
|
||||||
|
gem "stamp"
|
||||||
|
|
||||||
|
# Enumeration fields
|
||||||
|
gem 'enumerize'
|
||||||
|
|
||||||
|
# Pagination
|
||||||
|
gem "kaminari", "~> 0.15.1"
|
||||||
|
|
||||||
|
# HAML
|
||||||
|
gem "haml-rails"
|
||||||
|
|
||||||
|
# Files attachments
|
||||||
|
gem "carrierwave"
|
||||||
|
|
||||||
|
# Drag and Drop UI
|
||||||
|
gem 'dropzonejs-rails'
|
||||||
|
|
||||||
|
# for aws storage
|
||||||
|
gem "fog", "~> 1.14"
|
||||||
|
gem "unf"
|
||||||
|
|
||||||
|
# Authorization
|
||||||
|
gem "six"
|
||||||
|
|
||||||
|
# Seed data
|
||||||
|
gem "seed-fu"
|
||||||
|
|
||||||
|
# Markup pipeline for GitLab
|
||||||
|
gem 'html-pipeline-gitlab', '~> 0.1.0'
|
||||||
|
|
||||||
|
# Markdown to HTML
|
||||||
|
gem "github-markup"
|
||||||
|
|
||||||
|
# Required markup gems by github-markdown
|
||||||
|
gem 'redcarpet', '~> 3.1.2'
|
||||||
|
gem 'RedCloth'
|
||||||
|
gem 'rdoc', '~>3.6'
|
||||||
|
gem 'org-ruby', '= 0.9.9'
|
||||||
|
gem 'creole', '~>0.3.6'
|
||||||
|
gem 'wikicloth', '=0.8.1'
|
||||||
|
gem 'asciidoctor', '= 0.1.4'
|
||||||
|
|
||||||
|
# Diffs
|
||||||
|
gem 'diffy', '~> 3.0.3'
|
||||||
|
|
||||||
|
# Application server
|
||||||
|
group :unicorn do
|
||||||
|
gem "unicorn", '~> 4.6.3'
|
||||||
|
gem 'unicorn-worker-killer'
|
||||||
|
end
|
||||||
|
|
||||||
|
# State machine
|
||||||
|
gem "state_machine"
|
||||||
|
|
||||||
|
# Issue tags
|
||||||
|
gem "acts-as-taggable-on"
|
||||||
|
|
||||||
|
# Background jobs
|
||||||
|
gem 'slim'
|
||||||
|
gem 'sinatra', require: nil
|
||||||
|
gem 'sidekiq', '2.17.0'
|
||||||
|
|
||||||
|
# HTTP requests
|
||||||
|
gem "httparty"
|
||||||
|
|
||||||
|
# Colored output to console
|
||||||
|
gem "colored"
|
||||||
|
|
||||||
|
# GitLab settings
|
||||||
|
gem 'settingslogic'
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
gem "foreman"
|
||||||
|
gem 'version_sorter'
|
||||||
|
|
||||||
|
# Cache
|
||||||
|
gem "redis-rails"
|
||||||
|
|
||||||
|
# Campfire integration
|
||||||
|
gem 'tinder', '~> 1.9.2'
|
||||||
|
|
||||||
|
# HipChat integration
|
||||||
|
gem "hipchat", "~> 0.14.0"
|
||||||
|
|
||||||
|
# Flowdock integration
|
||||||
|
gem "gitlab-flowdock-git-hook", "~> 0.4.2"
|
||||||
|
|
||||||
|
# Gemnasium integration
|
||||||
|
gem "gemnasium-gitlab-service", "~> 0.2"
|
||||||
|
|
||||||
|
# Slack integration
|
||||||
|
gem "slack-notifier", "~> 0.3.2"
|
||||||
|
|
||||||
|
# d3
|
||||||
|
gem "d3_rails", "~> 3.1.4"
|
||||||
|
|
||||||
|
# underscore-rails
|
||||||
|
gem "underscore-rails", "~> 1.4.4"
|
||||||
|
|
||||||
|
# Sanitize user input
|
||||||
|
gem "sanitize", '~> 2.0'
|
||||||
|
|
||||||
|
# Protect against bruteforcing
|
||||||
|
gem "rack-attack"
|
||||||
|
|
||||||
|
# Ace editor
|
||||||
|
gem 'ace-rails-ap'
|
||||||
|
|
||||||
|
# Keyboard shortcuts
|
||||||
|
gem 'mousetrap-rails'
|
||||||
|
|
||||||
|
# Semantic UI Sass for Sidebar
|
||||||
|
gem 'semantic-ui-sass', '~> 0.16.1.0'
|
||||||
|
|
||||||
|
gem "sass-rails", '~> 4.0.2'
|
||||||
|
gem "coffee-rails"
|
||||||
|
gem "uglifier"
|
||||||
|
gem "therubyracer"
|
||||||
|
gem 'turbolinks'
|
||||||
|
gem 'jquery-turbolinks'
|
||||||
|
|
||||||
|
gem 'select2-rails'
|
||||||
|
gem 'jquery-atwho-rails', "~> 0.3.3"
|
||||||
|
gem "jquery-rails"
|
||||||
|
gem "jquery-ui-rails"
|
||||||
|
gem "jquery-scrollto-rails"
|
||||||
|
gem "raphael-rails", "~> 2.1.2"
|
||||||
|
gem 'bootstrap-sass', '~> 3.0'
|
||||||
|
gem "font-awesome-rails", '~> 4.2'
|
||||||
|
gem "gitlab_emoji", "~> 0.0.1.1"
|
||||||
|
gem "gon", '~> 5.0.0'
|
||||||
|
gem 'nprogress-rails'
|
||||||
|
gem 'request_store'
|
||||||
|
gem "virtus"
|
||||||
|
|
||||||
|
group :development do
|
||||||
|
gem "annotate", "~> 2.6.0.beta2"
|
||||||
|
gem "letter_opener"
|
||||||
|
gem 'quiet_assets', '~> 1.0.1'
|
||||||
|
gem 'rack-mini-profiler', require: false
|
||||||
|
|
||||||
|
# Better errors handler
|
||||||
|
gem 'better_errors'
|
||||||
|
gem 'binding_of_caller'
|
||||||
|
|
||||||
|
gem 'rails_best_practices'
|
||||||
|
|
||||||
|
# Docs generator
|
||||||
|
gem "sdoc"
|
||||||
|
|
||||||
|
# thin instead webrick
|
||||||
|
gem 'thin'
|
||||||
|
end
|
||||||
|
|
||||||
|
group :development, :test do
|
||||||
|
gem 'coveralls', require: false
|
||||||
|
# gem 'rails-dev-tweaks'
|
||||||
|
gem 'spinach-rails'
|
||||||
|
gem "rspec-rails"
|
||||||
|
gem "capybara", '~> 2.2.1'
|
||||||
|
gem "pry"
|
||||||
|
gem "awesome_print"
|
||||||
|
gem "database_cleaner"
|
||||||
|
gem "launchy"
|
||||||
|
gem 'factory_girl_rails'
|
||||||
|
|
||||||
|
# Prevent occasions where minitest is not bundled in packaged versions of ruby (see #3826)
|
||||||
|
gem 'minitest', '~> 5.3.0'
|
||||||
|
|
||||||
|
# Generate Fake data
|
||||||
|
gem "ffaker"
|
||||||
|
|
||||||
|
# Guard
|
||||||
|
gem 'guard-rspec'
|
||||||
|
gem 'guard-spinach'
|
||||||
|
|
||||||
|
# Notification
|
||||||
|
gem 'rb-fsevent', require: darwin_only('rb-fsevent')
|
||||||
|
gem 'growl', require: darwin_only('growl')
|
||||||
|
gem 'rb-inotify', require: linux_only('rb-inotify')
|
||||||
|
|
||||||
|
# PhantomJS driver for Capybara
|
||||||
|
gem 'poltergeist', '~> 1.5.1'
|
||||||
|
|
||||||
|
gem 'jasmine', '2.0.2'
|
||||||
|
|
||||||
|
gem "spring", '1.1.3'
|
||||||
|
gem "spring-commands-rspec", '1.0.1'
|
||||||
|
gem "spring-commands-spinach", '1.0.0'
|
||||||
|
end
|
||||||
|
|
||||||
|
group :test do
|
||||||
|
gem "simplecov", require: false
|
||||||
|
gem "shoulda-matchers", "~> 2.1.0"
|
||||||
|
gem 'email_spec'
|
||||||
|
gem "webmock"
|
||||||
|
gem 'test_after_commit'
|
||||||
|
end
|
||||||
|
|
||||||
|
group :production do
|
||||||
|
gem "gitlab_meta", '7.0'
|
||||||
|
end
|
||||||
|
|
||||||
|
gem "newrelic_rpm"
|
@ -281,6 +281,7 @@ GEM
|
|||||||
addressable (~> 2.3)
|
addressable (~> 2.3)
|
||||||
letter_opener (1.1.2)
|
letter_opener (1.1.2)
|
||||||
launchy (~> 2.2)
|
launchy (~> 2.2)
|
||||||
|
libv8 (3.16.14.3)
|
||||||
listen (2.3.1)
|
listen (2.3.1)
|
||||||
celluloid (>= 0.15.2)
|
celluloid (>= 0.15.2)
|
||||||
rb-fsevent (>= 0.9.3)
|
rb-fsevent (>= 0.9.3)
|
||||||
@ -297,6 +298,7 @@ GEM
|
|||||||
multi_json (1.10.1)
|
multi_json (1.10.1)
|
||||||
multi_xml (0.5.5)
|
multi_xml (0.5.5)
|
||||||
multipart-post (1.2.0)
|
multipart-post (1.2.0)
|
||||||
|
mysql2 (0.3.16)
|
||||||
net-ldap (0.7.0)
|
net-ldap (0.7.0)
|
||||||
net-scp (1.1.2)
|
net-scp (1.1.2)
|
||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
@ -420,6 +422,7 @@ GEM
|
|||||||
redis-store (~> 1.1.0)
|
redis-store (~> 1.1.0)
|
||||||
redis-store (1.1.4)
|
redis-store (1.1.4)
|
||||||
redis (>= 2.2)
|
redis (>= 2.2)
|
||||||
|
ref (1.0.5)
|
||||||
request_store (1.0.5)
|
request_store (1.0.5)
|
||||||
require_all (1.3.2)
|
require_all (1.3.2)
|
||||||
rest-client (1.6.7)
|
rest-client (1.6.7)
|
||||||
@ -518,6 +521,9 @@ GEM
|
|||||||
term-ansicolor (1.2.2)
|
term-ansicolor (1.2.2)
|
||||||
tins (~> 0.8)
|
tins (~> 0.8)
|
||||||
test_after_commit (0.2.2)
|
test_after_commit (0.2.2)
|
||||||
|
therubyracer (0.12.0)
|
||||||
|
libv8 (~> 3.16.14.0)
|
||||||
|
ref
|
||||||
thin (1.6.1)
|
thin (1.6.1)
|
||||||
daemons (>= 1.0.9)
|
daemons (>= 1.0.9)
|
||||||
eventmachine (>= 1.0.0)
|
eventmachine (>= 1.0.0)
|
||||||
@ -691,6 +697,7 @@ DEPENDENCIES
|
|||||||
stamp
|
stamp
|
||||||
state_machine
|
state_machine
|
||||||
test_after_commit
|
test_after_commit
|
||||||
|
therubyracer
|
||||||
thin
|
thin
|
||||||
tinder (~> 1.9.2)
|
tinder (~> 1.9.2)
|
||||||
turbolinks
|
turbolinks
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +0,0 @@
|
|||||||
to regenerate Gemfile.nix and Gemfile.lock you need to
|
|
||||||
|
|
||||||
% nix-build bootstrap.nix
|
|
||||||
% cp result/Gemfile.nix ./
|
|
||||||
% cp result/Gemfile.lock ./
|
|
@ -1,45 +0,0 @@
|
|||||||
{ 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
|
|
||||||
|
|
||||||
substituteInPlace Gemfile --replace 'gem "therubyracer"' ""
|
|
||||||
|
|
||||||
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
|
|
||||||
'';
|
|
||||||
}
|
|
@ -1,41 +1,54 @@
|
|||||||
{ 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 }:
|
{ stdenv, lib, bundler, fetchgit, bundlerEnv, defaultGemConfig, libiconv, ruby
|
||||||
|
, tzdata, git
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
gemspec = map (gem: fetchurl { url=gem.url; sha256=gem.hash; }) (import ./Gemfile.nix);
|
gitlab = fetchgit {
|
||||||
|
url = "https://github.com/gitlabhq/gitlabhq.git";
|
||||||
|
rev = "477743a154e85c411e8a533980abce460b5669fc";
|
||||||
in stdenv.mkDerivation rec {
|
fetchSubmodules = false;
|
||||||
version = "7.4.2";
|
sha256 = "0jl1w9d46v8hc27h9s380ha07m3fd2zpflj4q9vywwcf570ahj7x";
|
||||||
name = "gitlab-${version}";
|
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://github.com/gitlabhq/gitlabhq/archive/v${version}.zip";
|
|
||||||
sha256 = "01iplkpa4scr0wcap6vjrc960dj15z4ciclaqswj0sz5hrp9glw6";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [
|
env = bundlerEnv {
|
||||||
ruby rubyLibs.bundler libyaml gdbm readline ncurses curl openssh redis zlib
|
name = "gitlab";
|
||||||
postgresql libxslt libxml2 pkgconfig libffi icu checkinstall logrotate docutils nodejs
|
inherit ruby;
|
||||||
git unzip gnumake which cmake
|
gemfile = ./Gemfile;
|
||||||
];
|
lockfile = ./Gemfile.lock;
|
||||||
|
gemset = ./gemset.nix;
|
||||||
|
meta = with lib; {
|
||||||
|
homepage = http://www.gitlab.com/;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
maintainers = [ ];
|
||||||
|
license = licenses.mit;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# cmake is required by a build depdenceny, not the main binary:
|
in
|
||||||
dontUseCmakeConfigure = true;
|
|
||||||
|
|
||||||
|
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
|
||||||
|
'';
|
||||||
patches = [
|
patches = [
|
||||||
./remove-hardcoded-locations.patch
|
./remove-hardcoded-locations.patch
|
||||||
];
|
];
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
# 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
|
||||||
|
|
||||||
mv config/gitlab.yml.example config/gitlab.yml
|
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:
|
# required for some gems:
|
||||||
cat > config/database.yml <<EOF
|
cat > config/database.yml <<EOF
|
||||||
@ -47,41 +60,17 @@ in stdenv.mkDerivation rec {
|
|||||||
username: gitlab
|
username: gitlab
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
EOF
|
EOF
|
||||||
|
'';
|
||||||
mkdir -p vendor/cache
|
buildPhase = ''
|
||||||
${stdenv.lib.concatStrings (map (gem: "ln -s ${gem} vendor/cache/${gem.name};") gemspec)}
|
export GEM_HOME=${env}/${ruby.gemPath}
|
||||||
|
|
||||||
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
|
bundle exec rake assets:precompile RAILS_ENV=production
|
||||||
'';
|
'';
|
||||||
|
installPhase = ''
|
||||||
meta = with stdenv.lib; {
|
mkdir -p $out/share
|
||||||
homepage = http://www.gitlab.com/;
|
cp -r . $out/share/gitlab
|
||||||
platforms = platforms.linux;
|
'';
|
||||||
maintainers = [ ];
|
passthru = {
|
||||||
license = licenses.mit;
|
inherit env;
|
||||||
|
inherit ruby;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
2398
pkgs/applications/version-management/gitlab/gemset.nix
Normal file
2398
pkgs/applications/version-management/gitlab/gemset.nix
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,56 +0,0 @@
|
|||||||
#!/usr/bin/env ruby
|
|
||||||
|
|
||||||
require 'rubygems'
|
|
||||||
require 'bundler'
|
|
||||||
require 'fileutils'
|
|
||||||
require 'net/http'
|
|
||||||
require 'net/https'
|
|
||||||
require 'uri'
|
|
||||||
|
|
||||||
TMP_DIR = "/tmp/gems"
|
|
||||||
|
|
||||||
FileUtils.rm_rf(TMP_DIR) if File.exists?(TMP_DIR)
|
|
||||||
FileUtils.mkdir TMP_DIR
|
|
||||||
|
|
||||||
GEMSERVER = "http://rubygems.org"
|
|
||||||
|
|
||||||
# inspect Gemfile.lock
|
|
||||||
lockfile = Bundler::LockfileParser.new(Bundler.read_file("Gemfile.lock"))
|
|
||||||
|
|
||||||
to_mirror = {}
|
|
||||||
|
|
||||||
uri = URI(GEMSERVER)
|
|
||||||
http = Net::HTTP.new(uri.host, uri.port)
|
|
||||||
http.use_ssl = uri.scheme == 'https'
|
|
||||||
|
|
||||||
requirements = {}
|
|
||||||
|
|
||||||
lockfile.specs.each do |s|
|
|
||||||
possible_gem_name = "#{s.name}-#{s.version.to_s}.gem"
|
|
||||||
|
|
||||||
Dir.chdir TMP_DIR do
|
|
||||||
filename = `gem fetch #{s.name} -v #{s.version.to_s}`.split()[1]
|
|
||||||
hash = `sha256sum #{filename}.gem`
|
|
||||||
url = "#{GEMSERVER}/downloads/#{filename}.gem"
|
|
||||||
puts url
|
|
||||||
requirements[s.name] = { :version => s.version.to_s,
|
|
||||||
:hash => hash.split().first,
|
|
||||||
:url => url,}
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
filename = 'Gemfile.nix'
|
|
||||||
|
|
||||||
File.open(filename, 'w') do |file|
|
|
||||||
file.puts "["
|
|
||||||
requirements.each do |name, info|
|
|
||||||
file.puts "{"
|
|
||||||
file.puts ['name = ', '"', name, '";'].join('')
|
|
||||||
file.puts ['hash = ', '"', info[:hash], '";'].join('')
|
|
||||||
file.puts ['url = ', '"', info[:url], '";'].join('')
|
|
||||||
file.puts ['version = ', '"', info[:version], '";'].join('')
|
|
||||||
file.puts "}"
|
|
||||||
end
|
|
||||||
file.puts "]"
|
|
||||||
end
|
|
@ -18,16 +18,26 @@
|
|||||||
# (to make gems behave if necessary).
|
# (to make gems behave if necessary).
|
||||||
|
|
||||||
{ lib, fetchurl, writeScript, ruby, libxml2, libxslt, python, stdenv, which
|
{ lib, fetchurl, writeScript, ruby, libxml2, libxslt, python, stdenv, which
|
||||||
, libiconv, postgresql, v8, v8_3_16_14, clang, sqlite, zlib, imagemagick, pkgconfig
|
, libiconv, postgresql, v8, v8_3_16_14, clang, sqlite, zlib, imagemagick
|
||||||
, ncurses, xapian, gpgme, utillinux, fetchpatch, tzdata
|
, pkgconfig , ncurses, xapian, gpgme, utillinux, fetchpatch, tzdata, icu, libffi
|
||||||
|
, cmake, libssh2, openssl, mysql
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
v8 = v8_3_16_14;
|
v8 = v8_3_16_14;
|
||||||
|
mysql = (import <nixpkgs> {}).mysql;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
charlock_holmes = attrs: {
|
||||||
|
buildInputs = [ which icu ];
|
||||||
|
};
|
||||||
|
|
||||||
|
ffi = attrs: {
|
||||||
|
buildInputs = [ libffi pkgconfig ];
|
||||||
|
};
|
||||||
|
|
||||||
gpgme = attrs: {
|
gpgme = attrs: {
|
||||||
buildInputs = [ gpgme ];
|
buildInputs = [ gpgme ];
|
||||||
};
|
};
|
||||||
@ -46,6 +56,10 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mysql2 = attrs: {
|
||||||
|
buildInputs = [ mysql zlib openssl ];
|
||||||
|
};
|
||||||
|
|
||||||
ncursesw = attrs: {
|
ncursesw = attrs: {
|
||||||
buildInputs = [ ncurses ];
|
buildInputs = [ ncurses ];
|
||||||
buildFlags = [
|
buildFlags = [
|
||||||
@ -77,6 +91,10 @@ in
|
|||||||
buildInputs = [ imagemagick pkgconfig ];
|
buildInputs = [ imagemagick pkgconfig ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
rugged = attrs: {
|
||||||
|
buildInputs = [ cmake pkgconfig openssl libssh2 zlib ];
|
||||||
|
};
|
||||||
|
|
||||||
sqlite3 = attrs: {
|
sqlite3 = attrs: {
|
||||||
buildFlags = [
|
buildFlags = [
|
||||||
"--with-sqlite3-include=${sqlite}/include"
|
"--with-sqlite3-include=${sqlite}/include"
|
||||||
@ -103,10 +121,10 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
tzdata = attrs: {
|
tzinfo = attrs: {
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace lib/tzinfo/zoneinfo_data_source.rb \
|
substituteInPlace lib/tzinfo/zoneinfo_data_source.rb \
|
||||||
--replace "/etc/zoneinfo" "${tzdata}/share/zoneinfo"
|
--replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
{ name, gemset, gemfile, lockfile, ruby ? defs.ruby, gemConfig ? defaultGemConfig
|
{ name, gemset, gemfile, lockfile, ruby ? defs.ruby, gemConfig ? defaultGemConfig
|
||||||
, enableParallelBuilding ? false # TODO: this might not work, given the env-var shinanigans.
|
, enableParallelBuilding ? false # TODO: this might not work, given the env-var shinanigans.
|
||||||
|
, postInstall ? null
|
||||||
, documentation ? false
|
, documentation ? false
|
||||||
, meta ? {}
|
, meta ? {}
|
||||||
}@args:
|
}@args:
|
||||||
@ -108,7 +109,7 @@ let
|
|||||||
FileUtils.cp(patched_package.spec.file_name, out)
|
FileUtils.cp(patched_package.spec.file_name, out)
|
||||||
''}
|
''}
|
||||||
else
|
else
|
||||||
cp -r . out
|
cp -r . $out
|
||||||
fi
|
fi
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
@ -273,13 +274,13 @@ stdenv.mkDerivation {
|
|||||||
export NIX_BUNDLER_GEMPATH=${bundler}/${ruby.gemPath}
|
export NIX_BUNDLER_GEMPATH=${bundler}/${ruby.gemPath}
|
||||||
|
|
||||||
export GEM_HOME=$out/${ruby.gemPath}
|
export GEM_HOME=$out/${ruby.gemPath}
|
||||||
export GEM_PATH=$GEM_HOME
|
export GEM_PATH=$NIX_BUNDLER_GEMPATH:$GEM_HOME
|
||||||
mkdir -p $GEM_HOME
|
mkdir -p $GEM_HOME
|
||||||
|
|
||||||
${allBuildFlags}
|
${allBuildFlags}
|
||||||
#export
|
|
||||||
|
|
||||||
mkdir gems
|
mkdir gems
|
||||||
|
cp ${bundler}/${bundler.ruby.gemPath}/cache/bundler-*.gem gems
|
||||||
${copyGems}
|
${copyGems}
|
||||||
|
|
||||||
${lib.optionalString (!documentation) ''
|
${lib.optionalString (!documentation) ''
|
||||||
@ -295,8 +296,13 @@ stdenv.mkDerivation {
|
|||||||
cp ${./monkey_patches.rb} monkey_patches.rb
|
cp ${./monkey_patches.rb} monkey_patches.rb
|
||||||
export RUBYOPT="-rmonkey_patches.rb -I $(pwd -P)"
|
export RUBYOPT="-rmonkey_patches.rb -I $(pwd -P)"
|
||||||
bundler install --frozen --binstubs ${lib.optionalString enableParallelBuilding "--jobs $NIX_BUILD_CORES"}
|
bundler install --frozen --binstubs ${lib.optionalString enableParallelBuilding "--jobs $NIX_BUILD_CORES"}
|
||||||
|
RUBYOPT=""
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
inherit postInstall;
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit ruby;
|
inherit ruby;
|
||||||
inherit bundler;
|
inherit bundler;
|
||||||
|
@ -1316,9 +1316,10 @@ let
|
|||||||
gifsicle = callPackage ../tools/graphics/gifsicle { };
|
gifsicle = callPackage ../tools/graphics/gifsicle { };
|
||||||
|
|
||||||
# Evaluation broken by recent ruby changes.
|
# Evaluation broken by recent ruby changes.
|
||||||
# gitlab = callPackage ../applications/version-management/gitlab {
|
gitlab = callPackage ../applications/version-management/gitlab {
|
||||||
# libiconv = libiconvOrLibc;
|
libiconv = libiconvOrLibc;
|
||||||
# };
|
ruby = ruby_2_1_3;
|
||||||
|
};
|
||||||
|
|
||||||
# Evaluation broken by recent ruby changes.
|
# Evaluation broken by recent ruby changes.
|
||||||
# gitlab-shell = callPackage ../applications/version-management/gitlab-shell { };
|
# gitlab-shell = callPackage ../applications/version-management/gitlab-shell { };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user