Add gitlab and gitlab-shell.

I had to make several adjustments to make it work with nixos:

* Replace relative config file lookups with ENV variable.
* Modify gitlab-shell to not clear then environment when running
  pre-receive.
* Modify gitlab-shell to write some environment variables into
  the .authorized_keys file to make sure gitlab-shell reads the
  correct config file.

The current version requires the user to install the gitlab-shell
package into the systemPackages environment because
/run/current-system/sw/bin/gitlab-shell is hard-coded in the
.authorized_keys file.
@teh, yeah, it's kinda fragile, but still, thanks for the service. Can i
ask what are you using instead?

On Tue, Dec 16, 2014 at 3:46 PM, teh <notifications@github.com> wrote:
>
> In nixos/modules/services/misc/gitlab.nix
> <https://github.com/NixOS/nixpkgs/pull/4796#discussion-diff-21901594>:
>
> > +      wantedBy = [ "multi-user.target" ];
> > +      environment.HOME = "${cfg.stateDir}/home";
> > +      environment.UNICORN_PATH = "${cfg.stateDir}/";
> > +      environment.GITLAB_PATH = "${pkgs.gitlab}/share/gitlab/";
> > +      environment.GITLAB_APPLICATION_LOG_PATH = "${cfg.stateDir}/log/application.log";
> > +      environment.GITLAB_SATELLITES_PATH = "${cfg.stateDir}/satellites";
> > +      environment.GITLAB_SHELL_PATH = "${pkgs.gitlab-shell}";
> > +      environment.GITLAB_REPOSITORIES_PATH = "${cfg.stateDir}/repositories";
> > +      environment.GITLAB_SHELL_HOOKS_PATH = "${cfg.stateDir}/shell/hooks";
> > +      environment.BUNDLE_GEMFILE = "${pkgs.gitlab}/share/gitlab/Gemfile";
> > +      environment.GITLAB_EMAIL_FROM = "${cfg.emailFrom}";
> > +      environment.GITLAB_SHELL_CONFIG_PATH = "${cfg.stateDir}/shell/config.yml";
> > +      environment.GITLAB_SHELL_SECRET_PATH = "${cfg.stateDir}/config/gitlab_shell_secret";
> > +      environment.GITLAB_HOST = "${cfg.host}";
> > +      environment.GITLAB_DATABASE_HOST = "${cfg.databaseHost}";
> > +      environment.GITLAB_DATABASE_PASSWORD = "${cfg.databasePassword}";
>
> Apologies, I don't know. Is there a lot of contention on the test machine?
> Can you strace to figure out where it gets stuck if anywhere? perf may also
> hint at issues.
>
> We've decided not to use gitlab in the end because it feels way too
> fragile :(
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/NixOS/nixpkgs/pull/4796/files#r21901594>.
>


-- 
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)

mQENBFEY1PEBCADPOfERF2wo4qeoq9L1m2z4pKfWqNd4B6BsoFUWPNd7BXmY+9JG
jJddSkmYobWec7XjAFTBL0Xbttt+rK9SIED2dCOmU1FYMQElhGlM3PNA3kaiQFeV
ijgH318GCfZzDd0dWa5TN/IshVeWXwgngsIEmZTVf1VSeb3eO3B8Fxe3zsSLUq0b
71MmU5eLVP9pMkm5V5BTYp+lV70FIekKygkKq+uTDo1csWUatbs4Qvgv37Bymy2t
oTwOBXGoinQk5N/6asR1jWs3vKv0L0SruoZy/kEG/jXb4l2OZUP85EVMganYKouE
OchVmcmhBdWV+t3HK4r2ATfyEcMRzvzSflA1ABEBAAG0Jkpha2EgSHVkb2tsaW4g
PGpha2FodWRva2xpbkBnbWFpbC5jb20+iQE+BBMBAgAoBQJRGNTxAhsDBQkB4TOA
BgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRD6Zxi5hZclKnXNCACLOKa8abQp
eTWv9SXUwC7LVM5pP2mXcgn+Ipqr6YWBdLx4Iij0YlvUok9VeKvwTpUlT+cx++o3
wCM3AYrUyJE+zrtw49lInUmutz9seqJLU895oq+D+UuGoORrLBpEZrYR5f83uUmQ
E3Z1ZmWrNGXYtITWDtVZD/KauMF2nkPcmy/XaYXhd4WHD81DGNlKtGAHig6A3Phc
8Mr0A4yLDeRQJm8lCFEsxMJUNTupgY+ybbsMfVGx1gQvvGOTioV8CLCoRchUCCcm
YPArFg40KzIDSNjwdo9EVZDnlPx1hbOppfQydxP+JVnZsqoYmVY4UhIWi/NfOl3V
UMjl338INW1zuQENBFEY1PEBCADRSIfelOMjaTH7IfpMFFUc5Gys//njFnW9QAUg
wyfs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