diff options
author | azahi <azat@bahawi.net> | 2024-10-17 21:03:21 +0300 |
---|---|---|
committer | azahi <azat@bahawi.net> | 2024-10-17 21:03:21 +0300 |
commit | a2f54d0c84bd5ab96121a06757f58e921741330b (patch) | |
tree | 0267bdee3719cebf3f018054f384a0bf9ce99d3b | |
parent | 2024-10-14 (diff) |
2024-10-17
-rw-r--r-- | modules/git/default.nix | 96 |
1 files changed, 89 insertions, 7 deletions
diff --git a/modules/git/default.nix b/modules/git/default.nix index 27c07c4..092a82c 100644 --- a/modules/git/default.nix +++ b/modules/git/default.nix @@ -202,26 +202,71 @@ in cgit.${domain} = { enable = true; + package = pkgs.cgit-pink; + # We make gitolite repos readable by the common group. + user = "git"; group = "git"; scanPath = "${config.services.gitolite.dataDir}/repositories"; settings = { - root-title = "cgit"; - root-desc = "https://github.com/azahi"; + root-title = "git.azahi.cc"; + root-desc = "British scientists have discovered that using GitHub frequently is harmful to one's mental health, especially GitHub Actions..."; - clone-url = "https://${domain}/$CGIT_REPO_URL"; + footer = "${pkgs.writeText "cgit-footer" '' + <p style="text-align: center;">Consider giving <a href="https://nixos.org">Nix/NixOS</a> a try! <3</p> + ''}"; - about-filter = "${package}/lib/cgit/filters/about-formatting.sh"; + about-filter = "${pkgs.writeScript "cgit-about-filter.sh" '' + #!${pkgs.bash}/bin/sh + filename=$1 + case "$filename" in + *.md) + exec ${pkgs.pandoc}/bin/pandoc -f markdown -t html + ;; + *.org) + exec ${pkgs.pandoc}/bin/pandoc -f org -t html + ;; + *) + echo "<pre>" + ${pkgs.coreutils}/bin/cat + echo "</pre>" + ;; + esac + ''}"; source-filter = "${package}/lib/cgit/filters/syntax-highlighting.py"; commit-filter = "${package}/lib/cgit/filters/commit-links.sh"; + readme = [ + ":README" + ":readme.md" + ":readme.org" + ]; + + clone-url = "https://$HTTP_HOST/$CGIT_REPO_URL"; + + enable-blame = true; + enable-commit-graph = true; + enable-follow-links = true; enable-git-config = true; enable-gitweb-owner = true; + enable-html-serving = true; + enable-http-clone = true; + enable-index-links = false; + enable-index-owner = false; + enable-log-filecount = true; + enable-log-linecount = true; + enable-subject-links = true; + enable-tree-linenumbers = true; + + branch-sort = "age"; + repository-sort = "age"; + remove-suffix = true; logo = "/logo.gif"; + logo-link = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"; }; }; @@ -268,12 +313,49 @@ in "= /cgit.css" = { alias = pkgs.writeText "cgit.css" '' ${readFile "${package}/cgit/cgit.css"} + * { + line-height: 1.25em; + } div#cgit { font-family: ${ concatMapStringsSep ", " (f: ''"${f}"'') config.fonts.fontconfig.defaultFonts.monospace - }, monospace !important; - -moz-tab-size: 2 !important; - tab-size: 2 !important; + }, monospace; + -moz-tab-size: 2; + tab-size: 2; + max-width: 117ch; + margin: auto; + } + div#cgit table#header td.sub { + border-top: none; + } + div#cgit table#header td.sub.right { + padding-right: 1em; + } + div#cgit table.tabs { + border-bottom: none; + } + div#cgit div.content { + border-bottom: none; + } + div#cgit table.list th a { + color: inherit; + } + div#cgit table.list tr:nth-child(even) { + background: inherit; + } + div#cgit table.list tr:hover { + background: inherit; + } + div#cgit table.list tr.nohover-highlight:hover:nth-child(even) { + background: inherit; + } + div#cgit table.blob td.linenumbers a:target { + color: goldenrod; + text-decoration: underline; + outline: none; + } + div#cgit div#summary { + max-width: 80ch; } ''; extraConfig = mkForce ""; |