at 16.09-beta 62 lines 2.1 kB view raw
1{ stdenv, ruby, bundler, fetchFromGitLab }: 2 3stdenv.mkDerivation rec { 4 version = "3.4.0"; 5 name = "gitlab-shell-${version}"; 6 7 srcs = fetchFromGitLab { 8 owner = "gitlab-org"; 9 repo = "gitlab-shell"; 10 rev = "v${version}"; 11 sha256 = "1vhwsiz6n96i6cbcqbf4pa93nzx4xkaph2lmzh0nm4mi5ydl49is"; 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 = { 60 platforms = stdenv.lib.platforms.unix; 61 }; 62}