at 17.09-beta 65 lines 2.2 kB view raw
1{ stdenv, ruby, bundler, fetchFromGitLab }: 2 3stdenv.mkDerivation rec { 4 version = "4.1.1"; 5 name = "gitlab-shell-${version}"; 6 7 srcs = fetchFromGitLab { 8 owner = "gitlab-org"; 9 repo = "gitlab-shell"; 10 rev = "v${version}"; 11 sha256 = "1i7dqs0csqcjwkvg8csz5f1zxy1inrzxzz3g9j618aldqxzjfgnr"; 12 }; 13 14 buildInputs = [ 15 ruby bundler 16 ]; 17 18 patches = [ ./remove-hardcoded-locations.patch ]; 19 20 installPhase = '' 21 mkdir -p $out/ 22 cp -R . $out/ 23 24 # Nothing to install ATM for non-development but keeping the 25 # install command anyway in case that changes in the future: 26 export HOME=$(pwd) 27 bundle install -j4 --verbose --local --deployment --without development test 28 ''; 29 30 # gitlab-shell will try to read its config relative to the source 31 # code by default which doesn't work in nixos because it's a 32 # read-only filesystem 33 postPatch = '' 34 substituteInPlace lib/gitlab_config.rb --replace\ 35 "File.join(ROOT_PATH, 'config.yml')"\ 36 "ENV['GITLAB_SHELL_CONFIG_PATH']" 37 38 # Note that we're running gitlab-shell from current-system/sw 39 # because otherwise updating gitlab-shell won't be reflected in 40 # the hardcoded path of the authorized-keys file: 41 substituteInPlace lib/gitlab_keys.rb --replace\ 42 "\"#{ROOT_PATH}/bin/gitlab-shell"\ 43 "\"GITLAB_SHELL_CONFIG_PATH=#{ENV['GITLAB_SHELL_CONFIG_PATH']} /run/current-system/sw/bin/gitlab-shell" 44 45 # We're setting GITLAB_SHELL_CONFIG_PATH in the ssh authorized key 46 # environment because we need it in gitlab_configrb 47 # . unsetenv_others will remove that so we're not doing it for 48 # now. 49 # 50 # TODO: Are there any security implications? The commit adding 51 # unsetenv_others didn't mention anything... 52 # 53 # Kernel::exec({'PATH' => ENV['PATH'], 'LD_LIBRARY_PATH' => ENV['LD_LIBRARY_PATH'], 'GL_ID' => ENV['GL_ID']}, *args, unsetenv_others: true) 54 substituteInPlace lib/gitlab_shell.rb --replace\ 55 " *args, unsetenv_others: true)"\ 56 " *args)" 57 ''; 58 59 meta = with stdenv.lib; { 60 homepage = http://www.gitlab.com/; 61 platforms = platforms.unix; 62 maintainers = with maintainers; [ fpletz ]; 63 license = licenses.mit; 64 }; 65}