2017-07-05 22:53:31 +01:00
|
|
|
{ stdenv, ruby, bundler, fetchFromGitLab, go }:
|
2014-10-25 17:22:49 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-01-07 03:58:31 +00:00
|
|
|
version = "5.10.2";
|
2014-10-25 17:22:49 +01:00
|
|
|
name = "gitlab-shell-${version}";
|
2015-01-25 21:10:04 +00:00
|
|
|
|
2016-01-30 13:47:04 +00:00
|
|
|
srcs = fetchFromGitLab {
|
|
|
|
owner = "gitlab-org";
|
|
|
|
repo = "gitlab-shell";
|
|
|
|
rev = "v${version}";
|
2018-01-07 03:58:31 +00:00
|
|
|
sha256 = "16lwnzsppql7pkf8fka6cwkghdr57g225zvln9ii29w7nzz1hvaf";
|
2014-10-25 17:22:49 +01:00
|
|
|
};
|
|
|
|
|
2018-01-07 03:58:31 +00:00
|
|
|
buildInputs = [ ruby bundler go ];
|
2014-10-25 17:22:49 +01:00
|
|
|
|
2017-07-05 22:53:31 +01:00
|
|
|
patches = [ ./remove-hardcoded-locations.patch ./fixes.patch ];
|
2016-01-30 13:47:04 +00:00
|
|
|
|
2014-10-25 17:22:49 +01:00
|
|
|
installPhase = ''
|
2017-07-05 22:53:31 +01:00
|
|
|
ruby bin/compile
|
2014-10-25 17:22:49 +01:00
|
|
|
mkdir -p $out/
|
|
|
|
cp -R . $out/
|
|
|
|
|
|
|
|
# Nothing to install ATM for non-development but keeping the
|
|
|
|
# install command anyway in case that changes in the future:
|
|
|
|
export HOME=$(pwd)
|
|
|
|
bundle install -j4 --verbose --local --deployment --without development test
|
|
|
|
'';
|
2015-01-25 21:10:04 +00:00
|
|
|
|
2014-10-25 17:22:49 +01:00
|
|
|
# gitlab-shell will try to read its config relative to the source
|
|
|
|
# code by default which doesn't work in nixos because it's a
|
|
|
|
# read-only filesystem
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace lib/gitlab_config.rb --replace\
|
|
|
|
"File.join(ROOT_PATH, 'config.yml')"\
|
|
|
|
"ENV['GITLAB_SHELL_CONFIG_PATH']"
|
|
|
|
|
|
|
|
# Note that we're running gitlab-shell from current-system/sw
|
|
|
|
# because otherwise updating gitlab-shell won't be reflected in
|
|
|
|
# the hardcoded path of the authorized-keys file:
|
|
|
|
substituteInPlace lib/gitlab_keys.rb --replace\
|
2015-10-21 18:48:56 +01:00
|
|
|
"\"#{ROOT_PATH}/bin/gitlab-shell"\
|
|
|
|
"\"GITLAB_SHELL_CONFIG_PATH=#{ENV['GITLAB_SHELL_CONFIG_PATH']} /run/current-system/sw/bin/gitlab-shell"
|
2014-10-25 17:22:49 +01:00
|
|
|
|
|
|
|
# We're setting GITLAB_SHELL_CONFIG_PATH in the ssh authorized key
|
|
|
|
# environment because we need it in gitlab_configrb
|
|
|
|
# . unsetenv_others will remove that so we're not doing it for
|
|
|
|
# now.
|
|
|
|
#
|
|
|
|
# TODO: Are there any security implications? The commit adding
|
|
|
|
# unsetenv_others didn't mention anything...
|
2017-08-06 15:27:54 +01:00
|
|
|
#
|
2014-10-25 17:22:49 +01:00
|
|
|
# Kernel::exec({'PATH' => ENV['PATH'], 'LD_LIBRARY_PATH' => ENV['LD_LIBRARY_PATH'], 'GL_ID' => ENV['GL_ID']}, *args, unsetenv_others: true)
|
|
|
|
substituteInPlace lib/gitlab_shell.rb --replace\
|
|
|
|
" *args, unsetenv_others: true)"\
|
|
|
|
" *args)"
|
|
|
|
'';
|
|
|
|
|
2016-09-27 14:49:21 +01:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://www.gitlab.com/;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ fpletz ];
|
|
|
|
license = licenses.mit;
|
2016-08-02 17:06:29 +01:00
|
|
|
};
|
2014-10-25 17:22:49 +01:00
|
|
|
}
|