techne/cgit.org
2024-09-20 21:17:26 -05:00

139 lines
3.3 KiB
Org Mode

#+title: Cgit
#+setupfile: ../org-templates/page.org
** Install Cgit with Caddy
*** Dependencies
[[https://github.com/caddyserver/xcaddy/releases][xcaddy]] package from releases page.
Install [[https://github.com/aksdb/caddy-cgi][caddy-cgi]].
#+begin_src shell
xcaddy build --with github.com/aksdb/caddy-cgi/v2
#+end_src
Install remaining dependencies.
#+begin_src shell
sudo apt install gitolite3 cgit python-is-python3 python3-pygments python3-markdown docutils-common groff
#+end_src
*** Configuration
Make a git user.
#+begin_src shell
sudo adduser --system --shell /bin/bash --group --disabled-password --home /home/git git
#+end_src
Configure gitolite for the git user in ~~/.gitolite.rc~.
#+begin_src shell
UMASK => 0027,
GIT_CONFIG_KEYS => 'gitweb.description gitweb.owner gitweb.homepage gitweb.category',
#+end_src
Add caddy user to the git group.
#+begin_src shell
sudo usermod -aG git caddy
#+end_src
Configure cgit in ~/etc/cgitrc~.
#+begin_src rc
#
# cgit config
# see cgitrc(5) for details
css=/cgit/cgit.css
logo=/cgit/cgit.png
favicon=/cgit/favicon.ico
enable-index-links=1
enable-commit-graph=1
enable-log-filecount=1
enable-log-linecount=1
enable-git-config=1
branch-sort=age
repository-sort=name
clone-url=https://git.hyperreal.coffee/$CGIT_REPO_URL git://git.hyperreal.coffee/$CGIT_REPO_URL ssh://git@git.hyperreal.coffee:$CGIT_REPO_URL
root-title=hyperreal.coffee Git repositories
root-desc=Source code and configs for my projects
##
## List of common mimetypes
##
mimetype.gif=image/gif
mimetype.html=text/html
mimetype.jpg=image/jpeg
mimetype.jpeg=image/jpeg
mimetype.pdf=application/pdf
mimetype.png=image/png
mimetype.svg=image/svg+xml
# Enable syntax highlighting
source-filter=/usr/lib/cgit/filters/syntax-highlighting.py
# Format markdown, rst, manpages, text files, html files, and org files.
about-filter=/usr/lib/cgit/filters/about-formatting.sh
##
### Search for these files in the root of the default branch of repositories
### for coming up with the about page:
##
readme=:README.md
readme=:README.org
robots=noindex, nofollow
section=personal-config
repo.url=doom-emacs-config
repo.path=/home/git/repositories/doom-emacs-config.git
repo.desc=My Doom Emacs config
#+end_src
*** org-mode README
#+begin_quote
Note: I haven't gotten this to work yet. :-(
#+end_quote
#+begin_src shell
git clone https://github.com/amartos/cgit-org2html.git
cd cgit-org2html
sudo cp -v org2html /usr/lib/cgit/filters/html-converters/
sudo chmod +x /usr/lib/cgit/filters/html-converters/org2html
#+end_src
Download [[https://gist.github.com/amartos/fbfa82af4ff33823c90acbf23f7a3f0e][blob-formatting.sh]].
#+begin_src shell
sudo cp -v blob-formatting.sh /usr/lib/cgit/filters/
#+end_src
**** Catppuccin Mocha palette for org2html.css
#+begin_src shell
git clone https://github.com/amartos/cgit-org2html.git
cd cgit-org2html/css
#+end_src
Change the color variables to Catppuccin Mocha hex codes.
#+begin_src scss
$red: #f38ba8;
$green: #a6e3a1;
$orange: #fab387;
$gray: #585b70;
$yellow: #f9e2af;
$cyan: #89dceb;
$teal: #94e2d5;
$black: #11111b;
$white: #cdd6f4;
$cream: #f2cdcd;
#+end_src
Install sass.
#+begin_src shell
sudo apt install -y sass
#+end_src
Generate org2html.css from the scss files, and copy the result to the cgit css directory.
#+begin_src shell
sass org2html.scss:org2html.css
sudo cp -v org2html.css /usr/share/cgit/css/
#+end_src