]>
Commit | Line | Data |
---|---|---|
d60c4da1 | 1 | { gitweb, writeText, stdenv, coreutils, writeScript, gitolite, git, cgit, gitoliteDir, mailcap, highlight }: |
5c101474 | 2 | rec { |
950ca5ee | 3 | varDir = gitoliteDir; |
5c101474 IB |
4 | config = writeText "gitweb.conf" '' |
5 | $git_temp = "/tmp"; | |
cf80b4f2 | 6 | |
5c101474 IB |
7 | # The directories where your projects are. Must not end with a |
8 | # slash. | |
9 | $projectroot = "${varDir}/repositories"; | |
cf80b4f2 | 10 | |
5c101474 IB |
11 | $projects_list = "${varDir}/projects.list"; |
12 | $strict_export = "true"; | |
cf80b4f2 | 13 | |
5c101474 IB |
14 | # Base URLs for links displayed in the web interface. |
15 | our @git_base_url_list = qw(ssh://gitolite@git.immae.eu https://git.immae.eu); | |
cf80b4f2 | 16 | |
5c101474 IB |
17 | $feature{'blame'}{'default'} = [1]; |
18 | $feature{'avatar'}{'default'} = ['gravatar']; | |
19 | $feature{'highlight'}{'default'} = [1]; | |
cf80b4f2 | 20 | |
5c101474 IB |
21 | @stylesheets = ("gitweb-theme/gitweb.css"); |
22 | $logo = "gitweb-theme/git-logo.png"; | |
23 | $favicon = "gitweb-theme/git-favicon.png"; | |
24 | $javascript = "gitweb-theme/gitweb.js"; | |
25 | $logo_url = "https://git.immae.eu/"; | |
26 | $projects_list_group_categories = "true"; | |
27 | $projects_list_description_width = 60; | |
28 | $project_list_default_category = "__Others__"; | |
e570c4f5 | 29 | $highlight_bin = "${highlight}/bin/highlight"; |
5c101474 | 30 | ''; |
d60c4da1 IB |
31 | aboutFilter = writeScript "about-filter.sh" '' |
32 | #!${stdenv.shell} | |
33 | ||
34 | if [ -f "$CGIT_REPO_PATH/README.html" ]; then | |
35 | cat "$CGIT_REPO_PATH/README.html" | |
36 | else | |
37 | ${cgit}/lib/cgit/filters/about-formatting.sh "$@" | |
38 | fi | |
39 | ''; | |
40 | cgitConfig = writeText "cgitrc" '' | |
41 | css=/cgit-css/cgit.css | |
42 | logo=/cgit-css/cgit.png | |
43 | favicon=/cgit-css/favicon.ico | |
c4ce3984 | 44 | head-include=${./cgit_js.html} |
d60c4da1 IB |
45 | |
46 | root-title=Immae’s git | |
47 | root-desc=To go back to the old interface: https://git.immae.eu/?old | |
48 | readme=:README.md | |
49 | readme=:readme.md | |
50 | readme=:README | |
51 | readme=:DOCUMENTATION.md | |
52 | about-filter=${aboutFilter} | |
53 | #${cgit}/lib/cgit/filters/about-formatting.sh | |
54 | source-filter=${cgit}/lib/cgit/filters/syntax-highlighting.py | |
55 | ||
56 | enable-blame=1 | |
57 | enable-index-links=1 | |
58 | enable-commit-graph=1 | |
59 | enable-log-filecount=1 | |
60 | enable-log-linecount=1 | |
61 | ||
62 | enable-html-serving=1 | |
63 | # Allow using gitweb.* keys | |
64 | enable-git-config=1 | |
65 | ||
66 | side-by-side-diffs=1 | |
67 | snapshots=tar.gz tar.zst zip | |
68 | mimetype-file=${mailcap}/etc/mime.types | |
69 | ||
70 | section=__Others__ | |
71 | clone-url=ssh://gitolite@git.immae.eu/$CGIT_REPO_URL https://git.immae.eu/$CGIT_REPO_URL | |
72 | #section-from-path=1 | |
73 | project-list=${varDir}/projects.list | |
74 | scan-path=${varDir}/repositories | |
75 | ''; | |
a95ab089 | 76 | apache = rec { |
5c101474 IB |
77 | user = "wwwrun"; |
78 | group = "wwwrun"; | |
79 | modules = [ "cgid" ]; | |
750fe5a4 | 80 | root = gitweb; |
5c101474 IB |
81 | vhostConf = '' |
82 | SetEnv GIT_PROJECT_ROOT ${varDir}/repositories/ | |
83 | ScriptAliasMatch \ | |
84 | "(?x)^/(.*/(HEAD | \ | |
85 | info/refs | \ | |
86 | objects/(info/[^/]+ | \ | |
87 | [0-9a-f]{2}/[0-9a-f]{38} | \ | |
88 | pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ | |
89 | git-(upload|receive)-pack))$" \ | |
90 | ${git}/libexec/git-core/git-http-backend/$1 | |
cf80b4f2 | 91 | |
5c101474 IB |
92 | <Directory "${git}/libexec/git-core"> |
93 | Require all granted | |
94 | </Directory> | |
a95ab089 | 95 | <Directory "${root}"> |
5c101474 IB |
96 | DirectoryIndex gitweb.cgi |
97 | Require all granted | |
98 | AllowOverride None | |
99 | Options ExecCGI FollowSymLinks | |
100 | <Files gitweb.cgi> | |
101 | SetHandler cgi-script | |
102 | SetEnv GITWEB_CONFIG "${config}" | |
103 | </Files> | |
104 | </Directory> | |
d60c4da1 IB |
105 | |
106 | SetEnv CGIT_CONFIG ${cgitConfig} | |
107 | ScriptAlias /cgit "${cgit}/cgit/cgit.cgi/" | |
108 | Alias /cgit-css "${cgit}/cgit" | |
109 | <Directory "${cgit}/cgit/"> | |
110 | AllowOverride None | |
111 | Options ExecCGI FollowSymlinks | |
112 | Require all granted | |
113 | </Directory> | |
114 | ||
115 | RewriteEngine On | |
116 | RewriteCond %{QUERY_STRING} ^$ | |
117 | RewriteRule ^/?$ /cgit [L,R=302] | |
c4ce3984 IB |
118 | |
119 | RewriteCond %{REQUEST_URI} ^(.*)(\.git)?/?$ | |
120 | RewriteCond ${varDir}/repositories/%1.git/HEAD -f | |
121 | RewriteRule ^(.+)$ /cgit$1 [L,R=302] | |
5c101474 | 122 | ''; |
cf80b4f2 | 123 | }; |
5c101474 | 124 | } |