diff options
author | Florian Klink <flokli@flokli.de> | 2018-11-23 13:12:02 +0100 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2018-11-23 13:14:28 +0100 |
commit | 8e8f692e22b16176fa1ba83adfdfea09c49d0dbf (patch) | |
tree | 79d1f5ab720c02fb405b8b38b843a96803564f62 /pkgs/applications/version-management/gitlab/gitlab-shell | |
parent | 80738ed9dc0ce48d7796baed5364eef8072c794d (diff) | |
download | nixlib-8e8f692e22b16176fa1ba83adfdfea09c49d0dbf.tar nixlib-8e8f692e22b16176fa1ba83adfdfea09c49d0dbf.tar.gz nixlib-8e8f692e22b16176fa1ba83adfdfea09c49d0dbf.tar.bz2 nixlib-8e8f692e22b16176fa1ba83adfdfea09c49d0dbf.tar.lz nixlib-8e8f692e22b16176fa1ba83adfdfea09c49d0dbf.tar.xz nixlib-8e8f692e22b16176fa1ba83adfdfea09c49d0dbf.tar.zst nixlib-8e8f692e22b16176fa1ba83adfdfea09c49d0dbf.zip |
gitlab-shell: move to pkgs/applications/version-management/gitlab
Diffstat (limited to 'pkgs/applications/version-management/gitlab/gitlab-shell')
-rw-r--r-- | pkgs/applications/version-management/gitlab/gitlab-shell/default.nix | 45 | ||||
-rw-r--r-- | pkgs/applications/version-management/gitlab/gitlab-shell/remove-hardcoded-locations.patch | 27 |
2 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/applications/version-management/gitlab/gitlab-shell/default.nix b/pkgs/applications/version-management/gitlab/gitlab-shell/default.nix new file mode 100644 index 000000000000..69c4b9a255e3 --- /dev/null +++ b/pkgs/applications/version-management/gitlab/gitlab-shell/default.nix @@ -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; + }; +} diff --git a/pkgs/applications/version-management/gitlab/gitlab-shell/remove-hardcoded-locations.patch b/pkgs/applications/version-management/gitlab/gitlab-shell/remove-hardcoded-locations.patch new file mode 100644 index 000000000000..38181399eec8 --- /dev/null +++ b/pkgs/applications/version-management/gitlab/gitlab-shell/remove-hardcoded-locations.patch @@ -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 |