diff options
Diffstat (limited to 'pkgs/applications/version-management/gitlab/gitlab-shell/default.nix')
-rw-r--r-- | pkgs/applications/version-management/gitlab/gitlab-shell/default.nix | 69 |
1 files changed, 47 insertions, 22 deletions
diff --git a/pkgs/applications/version-management/gitlab/gitlab-shell/default.nix b/pkgs/applications/version-management/gitlab/gitlab-shell/default.nix index cd4784b36c8..3022aeac14e 100644 --- a/pkgs/applications/version-management/gitlab/gitlab-shell/default.nix +++ b/pkgs/applications/version-management/gitlab/gitlab-shell/default.nix @@ -1,40 +1,65 @@ -{ stdenv, ruby, bundler, fetchFromGitLab, go }: - -stdenv.mkDerivation rec { - version = "9.3.0"; - pname = "gitlab-shell"; +{ stdenv, ruby, bundler, fetchFromGitLab, buildGoPackage, bundlerEnv }: +let + version = "10.0.0"; src = fetchFromGitLab { owner = "gitlab-org"; repo = "gitlab-shell"; rev = "v${version}"; - sha256 = "1r000h4sgplx7giqvqs5iy0zh3drf6qa1iiq0mxlk3h9fshs1348"; + sha256 = "0n1llkb0jrqxm10l9wqmqxjycydqphgz0chbbf395d8pywyz826x"; }; + rubyEnv = bundlerEnv { + name = "gitlab-shell-env"; + inherit ruby; + gemdir = ./.; + }; + goPackage = buildGoPackage { + pname = "gitlab-shell-go"; + inherit src version; - buildInputs = [ ruby bundler go ]; - - patches = [ ./remove-hardcoded-locations.patch ]; + patches = [ ./remove-hardcoded-locations.patch ]; - installPhase = '' - export GOCACHE="$TMPDIR/go-cache" + goPackagePath = "gitlab.com/gitlab-org/gitlab-shell"; + goDeps = ./deps.nix; - 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 depends on an older version of gitaly which + # contains old, vendored versions of some packages; gitlab-shell + # also explicitly depends on newer versions of these libraries, + # but buildGoPackage exposes the vendored versions instead, + # leading to compilation errors. Since the vendored libraries + # aren't used here anyway, we'll just remove them. + postConfigure = '' + rm -r "$NIX_BUILD_TOP/go/src/gitlab.com/gitlab-org/gitaly/vendor/" + ''; + }; +in +stdenv.mkDerivation { + pname = "gitlab-shell"; + inherit src version; + + patches = [ ./remove-hardcoded-locations.patch ]; # 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'" + "File.join(ROOT_PATH, 'config.yml')" \ + "'/run/gitlab/shell-config.yml'" + ''; + + buildInputs = [ rubyEnv.wrappedRuby ]; + + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out/ + cp -R . $out/ + cp ${goPackage.bin}/bin/* $out/bin/ + + runHook postInstall ''; meta = with stdenv.lib; { |