]>
Commit | Line | Data |
---|---|---|
1 | { gitweb, writeText, stdenv, coreutils, writeScript, gitolite, git, cgit, gitoliteDir, mailcap, highlight }: | |
2 | rec { | |
3 | varDir = gitoliteDir; | |
4 | config = writeText "gitweb.conf" '' | |
5 | $git_temp = "/tmp"; | |
6 | ||
7 | # The directories where your projects are. Must not end with a | |
8 | # slash. | |
9 | $projectroot = "${varDir}/repositories"; | |
10 | ||
11 | $projects_list = "${varDir}/projects.list"; | |
12 | $strict_export = "true"; | |
13 | ||
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); | |
16 | ||
17 | $feature{'blame'}{'default'} = [1]; | |
18 | $feature{'avatar'}{'default'} = ['gravatar']; | |
19 | $feature{'highlight'}{'default'} = [1]; | |
20 | ||
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__"; | |
29 | $highlight_bin = "${highlight}/bin/highlight"; | |
30 | ''; | |
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 | |
44 | ||
45 | root-title=Immae’s git | |
46 | root-desc=To go back to the old interface: https://git.immae.eu/?old | |
47 | readme=:README.md | |
48 | readme=:readme.md | |
49 | readme=:README | |
50 | readme=:DOCUMENTATION.md | |
51 | about-filter=${aboutFilter} | |
52 | #${cgit}/lib/cgit/filters/about-formatting.sh | |
53 | source-filter=${cgit}/lib/cgit/filters/syntax-highlighting.py | |
54 | ||
55 | enable-blame=1 | |
56 | enable-index-links=1 | |
57 | enable-commit-graph=1 | |
58 | enable-log-filecount=1 | |
59 | enable-log-linecount=1 | |
60 | ||
61 | enable-html-serving=1 | |
62 | # Allow using gitweb.* keys | |
63 | enable-git-config=1 | |
64 | ||
65 | side-by-side-diffs=1 | |
66 | snapshots=tar.gz tar.zst zip | |
67 | mimetype-file=${mailcap}/etc/mime.types | |
68 | ||
69 | section=__Others__ | |
70 | clone-url=ssh://gitolite@git.immae.eu/$CGIT_REPO_URL https://git.immae.eu/$CGIT_REPO_URL | |
71 | #section-from-path=1 | |
72 | project-list=${varDir}/projects.list | |
73 | scan-path=${varDir}/repositories | |
74 | ''; | |
75 | apache = rec { | |
76 | user = "wwwrun"; | |
77 | group = "wwwrun"; | |
78 | modules = [ "cgid" ]; | |
79 | root = gitweb; | |
80 | vhostConf = '' | |
81 | SetEnv GIT_PROJECT_ROOT ${varDir}/repositories/ | |
82 | ScriptAliasMatch \ | |
83 | "(?x)^/(.*/(HEAD | \ | |
84 | info/refs | \ | |
85 | objects/(info/[^/]+ | \ | |
86 | [0-9a-f]{2}/[0-9a-f]{38} | \ | |
87 | pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ | |
88 | git-(upload|receive)-pack))$" \ | |
89 | ${git}/libexec/git-core/git-http-backend/$1 | |
90 | ||
91 | <Directory "${git}/libexec/git-core"> | |
92 | Require all granted | |
93 | </Directory> | |
94 | <Directory "${root}"> | |
95 | DirectoryIndex gitweb.cgi | |
96 | Require all granted | |
97 | AllowOverride None | |
98 | Options ExecCGI FollowSymLinks | |
99 | <Files gitweb.cgi> | |
100 | SetHandler cgi-script | |
101 | SetEnv GITWEB_CONFIG "${config}" | |
102 | </Files> | |
103 | </Directory> | |
104 | ||
105 | SetEnv CGIT_CONFIG ${cgitConfig} | |
106 | ScriptAlias /cgit "${cgit}/cgit/cgit.cgi/" | |
107 | Alias /cgit-css "${cgit}/cgit" | |
108 | <Directory "${cgit}/cgit/"> | |
109 | AllowOverride None | |
110 | Options ExecCGI FollowSymlinks | |
111 | Require all granted | |
112 | </Directory> | |
113 | ||
114 | RewriteEngine On | |
115 | RewriteCond %{QUERY_STRING} ^$ | |
116 | RewriteRule ^/?$ /cgit [L,R=302] | |
117 | ''; | |
118 | }; | |
119 | } |