Setting up gitweb

I’m trying to set up gitweb with Nginx but am a bit lost by the underdocumented options and lack of examples. I want to be able to view all repos in /home/tsv/git through the web interface. My current attempt is below, I’m not sure what I’m missing. Currently when visiting the URL I get the “Welcome to nginx!” page. I’m not even sure if I need both services or if I’m using the right options. Please help!

services.gitweb = {
  projectroot = "/home/tsv/git";

services.nginx = {
    enable = true;

    gitweb = {
      enable = true;
      virtualHost = "myurl";
    recommendedGzipSettings = true;
    recommendedOptimisation = true;
    recommendedProxySettings = true;
    recommendedTlsSettings = true;

    virtualHosts."" = {
      forceSSL = true;
      enableACME = true;
  security.acme = {
    acceptTerms = true;
    defaults = {
      email = "myemail";

You have two virtualHosts configured, one of which is myurl where gitweb is probably being served and where… the default hello is being served.

I’d probably just try changing gitweb.virtualHost to be

They are both set to that really sorry—I just neglected to change the other one to “myurl” before posting :sweat_smile:

Did you try … /gitweb? per the default: NixOS Search

For location? I have, but as I’m not currently specifying that it’s what it’s using anyway I guess.

I meant are you navigating to it, for example, I see gitweb: :wink:

Well now I feel liike an idiot! I don’t know why it just wasn’t clicking that “location” meant URL path. Whoops. It’s up now at Thanks :sweat_smile:

As you can see though, it can’t find any repos. /home/tsv/git contains one bare repo, but I also tried a different directory with normal repos just in case. Also tried setting the permissions to 777 to no avail.

Removed that and moved the projects to /srv/git, I guess they maybe need to be owned by root, as that seems to work. Thanks for the help.

1 Like