gitlab-shell: move to pkgs/applications/version-management/gitlab

This commit is contained in:
Florian Klink
2018-11-23 13:12:02 +01:00
parent 80738ed9dc
commit 8e8f692e22
3 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
{ stdenv, ruby, bundler, fetchFromGitLab, go }:
stdenv.mkDerivation rec {
version = "8.3.3";
name = "gitlab-shell-${version}";
src = fetchFromGitLab {
owner = "gitlab-org";
repo = "gitlab-shell";
rev = "v${version}";
sha256 = "1qapw0yvlw1nxjik7jpbbbl3yx299sfvdx67zsd5ai7bhk1gd8xl";
};
buildInputs = [ ruby bundler go ];
patches = [ ./remove-hardcoded-locations.patch ];
installPhase = ''
ruby bin/compile
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
'';
# 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')" \
"'/run/gitlab/shell-config.yml'"
'';
meta = with stdenv.lib; {
description = "SSH access and repository management app for GitLab";
homepage = http://www.gitlab.com/;
platforms = platforms.unix;
maintainers = with maintainers; [ fpletz globin ];
license = licenses.mit;
};
}

View File

@@ -0,0 +1,27 @@
diff --git a/go/internal/config/config.go b/go/internal/config/config.go
index c57b4de..88cfc95 100644
--- a/go/internal/config/config.go
+++ b/go/internal/config/config.go
@@ -27,7 +27,7 @@ func New() (*Config, error) {
}
cfg.RootDir = dir
- configBytes, err := ioutil.ReadFile(path.Join(cfg.RootDir, configFile))
+ configBytes, err := ioutil.ReadFile("/run/gitlab/shell-config.yml")
if err != nil {
return nil, err
}
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index 1452f95..2b40327 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -180,7 +180,8 @@ class GitlabShell
end
# We use 'chdir: ROOT_PATH' to let the next executable know where config.yml is.
- Kernel.exec(env, *args, unsetenv_others: true, chdir: ROOT_PATH)
+ # Except we don't, because we're already in the right directory on nixos!
+ Kernel.exec(env, *args, unsetenv_others: true)
end
def api