aboutsummaryrefslogtreecommitdiff
path: root/virtual/packages/gitweb.nix
blob: 1c2430a59d553f0a5c3542a42491e3bbb409830a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ gitweb, writeText, gitolite, git }:
rec {
  varDir = "/var/lib/gitolite";
  webRoot = gitweb;
  config = writeText "gitweb.conf" ''
    $git_temp = "/tmp";

    # The directories where your projects are. Must not end with a
    # slash.
    $projectroot = "${varDir}/repositories";

    $projects_list = "${varDir}/projects.list";
    $strict_export = "true";

    # Base URLs for links displayed in the web interface.
    our @git_base_url_list = qw(ssh://gitolite@git.immae.eu https://git.immae.eu);

    $feature{'blame'}{'default'} = [1];
    $feature{'avatar'}{'default'} = ['gravatar'];
    $feature{'highlight'}{'default'} = [1];

    @stylesheets = ("gitweb-theme/gitweb.css");
    $logo = "gitweb-theme/git-logo.png";
    $favicon = "gitweb-theme/git-favicon.png";
    $javascript = "gitweb-theme/gitweb.js";
    $logo_url = "https://git.immae.eu/";
    $projects_list_group_categories = "true";
    $projects_list_description_width = 60;
    $project_list_default_category = "__Others__";
    '';
  apache = {
    user = "wwwrun";
    group = "wwwrun";
    modules = [ "cgid" ];
    vhostConf = ''
      SetEnv GIT_PROJECT_ROOT ${varDir}/repositories/
      ScriptAliasMatch \
                  "(?x)^/(.*/(HEAD | \
                                  info/refs | \
                                  objects/(info/[^/]+ | \
                                          [0-9a-f]{2}/[0-9a-f]{38} | \
                                          pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
                                  git-(upload|receive)-pack))$" \
                  ${git}/libexec/git-core/git-http-backend/$1

      <Directory "${gitolite}">
        Require all granted
      </Directory>
      <Directory "${git}/libexec/git-core">
        Require all granted
      </Directory>
      <Directory "${webRoot}">
        DirectoryIndex gitweb.cgi
        Require all granted
        AllowOverride None
        Options ExecCGI FollowSymLinks
        <Files gitweb.cgi>
          SetHandler cgi-script
          SetEnv  GITWEB_CONFIG  "${config}"
        </Files>
      </Directory>
      '';
  };
}