diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2021-01-19 22:28:04 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2021-01-19 22:28:04 +0100 |
commit | d60c4da16690cbaca1891c35bf9c460e1c817a0b (patch) | |
tree | 293564b5f29957f60bc3edea2f3d1603b25c6e39 /modules | |
parent | 238587099b92027ad780053f0f6217ad88b61ad2 (diff) | |
download | Nix-d60c4da16690cbaca1891c35bf9c460e1c817a0b.tar.gz Nix-d60c4da16690cbaca1891c35bf9c460e1c817a0b.tar.zst Nix-d60c4da16690cbaca1891c35bf9c460e1c817a0b.zip |
Add cgit to replace gitweb
Diffstat (limited to 'modules')
-rw-r--r-- | modules/private/monitoring/objects_monitoring-1.nix | 2 | ||||
-rw-r--r-- | modules/private/websites/tools/git/gitweb.nix | 59 |
2 files changed, 59 insertions, 2 deletions
diff --git a/modules/private/monitoring/objects_monitoring-1.nix b/modules/private/monitoring/objects_monitoring-1.nix index 4b784ed..4687850 100644 --- a/modules/private/monitoring/objects_monitoring-1.nix +++ b/modules/private/monitoring/objects_monitoring-1.nix | |||
@@ -495,7 +495,7 @@ in | |||
495 | service_description = "gitweb website is running on git.immae.eu"; | 495 | service_description = "gitweb website is running on git.immae.eu"; |
496 | host_name = "eldiron.immae.eu"; | 496 | host_name = "eldiron.immae.eu"; |
497 | use = "external-web-service"; | 497 | use = "external-web-service"; |
498 | check_command = ["check_https" "git.immae.eu" "/" "git web interface"]; | 498 | check_command = ["check_https" "git.immae.eu" "/cgit" "<title>Immae’s git"]; |
499 | 499 | ||
500 | servicegroups = "webstatus-webapps"; | 500 | servicegroups = "webstatus-webapps"; |
501 | _webstatus_name = "Git"; | 501 | _webstatus_name = "Git"; |
diff --git a/modules/private/websites/tools/git/gitweb.nix b/modules/private/websites/tools/git/gitweb.nix index 2ee7a63..dab0c9e 100644 --- a/modules/private/websites/tools/git/gitweb.nix +++ b/modules/private/websites/tools/git/gitweb.nix | |||
@@ -1,4 +1,4 @@ | |||
1 | { gitweb, writeText, gitolite, git, gitoliteDir, highlight }: | 1 | { gitweb, writeText, stdenv, coreutils, writeScript, gitolite, git, cgit, gitoliteDir, mailcap, highlight }: |
2 | rec { | 2 | rec { |
3 | varDir = gitoliteDir; | 3 | varDir = gitoliteDir; |
4 | webRoot = gitweb; | 4 | webRoot = gitweb; |
@@ -29,6 +29,50 @@ rec { | |||
29 | $project_list_default_category = "__Others__"; | 29 | $project_list_default_category = "__Others__"; |
30 | $highlight_bin = "${highlight}/bin/highlight"; | 30 | $highlight_bin = "${highlight}/bin/highlight"; |
31 | ''; | 31 | ''; |
32 | aboutFilter = writeScript "about-filter.sh" '' | ||
33 | #!${stdenv.shell} | ||
34 | |||
35 | if [ -f "$CGIT_REPO_PATH/README.html" ]; then | ||
36 | cat "$CGIT_REPO_PATH/README.html" | ||
37 | else | ||
38 | ${cgit}/lib/cgit/filters/about-formatting.sh "$@" | ||
39 | fi | ||
40 | ''; | ||
41 | cgitConfig = writeText "cgitrc" '' | ||
42 | css=/cgit-css/cgit.css | ||
43 | logo=/cgit-css/cgit.png | ||
44 | favicon=/cgit-css/favicon.ico | ||
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 | ''; | ||
32 | apache = rec { | 76 | apache = rec { |
33 | user = "wwwrun"; | 77 | user = "wwwrun"; |
34 | group = "wwwrun"; | 78 | group = "wwwrun"; |
@@ -59,6 +103,19 @@ rec { | |||
59 | SetEnv GITWEB_CONFIG "${config}" | 103 | SetEnv GITWEB_CONFIG "${config}" |
60 | </Files> | 104 | </Files> |
61 | </Directory> | 105 | </Directory> |
106 | |||
107 | SetEnv CGIT_CONFIG ${cgitConfig} | ||
108 | ScriptAlias /cgit "${cgit}/cgit/cgit.cgi/" | ||
109 | Alias /cgit-css "${cgit}/cgit" | ||
110 | <Directory "${cgit}/cgit/"> | ||
111 | AllowOverride None | ||
112 | Options ExecCGI FollowSymlinks | ||
113 | Require all granted | ||
114 | </Directory> | ||
115 | |||
116 | RewriteEngine On | ||
117 | RewriteCond %{QUERY_STRING} ^$ | ||
118 | RewriteRule ^/?$ /cgit [L,R=302] | ||
62 | ''; | 119 | ''; |
63 | }; | 120 | }; |
64 | } | 121 | } |