diff options
Diffstat (limited to 'modules/server/spectrum')
-rw-r--r-- | modules/server/spectrum/cgit/default.nix | 60 | ||||
-rw-r--r-- | modules/server/spectrum/default.nix | 2 |
2 files changed, 61 insertions, 1 deletions
diff --git a/modules/server/spectrum/cgit/default.nix b/modules/server/spectrum/cgit/default.nix new file mode 100644 index 000000000000..c8a8eb3ac3a5 --- /dev/null +++ b/modules/server/spectrum/cgit/default.nix @@ -0,0 +1,60 @@ +{ pkgs, ... }: + +let + cgitFooter = pkgs.writeText "cgit-footer.html" '' + <div class="footer">software for Ⓐutonomy</div> + ''; + + spectrumReadme = pkgs.writeText "about.html" '' + <article> + + <h1>Contributing to Spectrum</h1> + + <p> + Want to contribute to Spectrum? We'd love to have you. + Have a look at the <a href="/contributing.html">online + documentation</a>. + + </article> + ''; + + sourceFilter = pkgs.runCommandNoCC "source-filter" { + nativeBuildInputs = with pkgs; with python3.pkgs; [ wrapPython ]; + } '' + mkdir -p $out/bin + sed s/pastie/friendly/g >$out/bin/syntax-highlighting.py \ + <${pkgs.cgit}/lib/cgit/filters/.syntax-highlighting.py-wrapped + chmod +x $out/bin/syntax-highlighting.py + wrapPythonPrograms + ''; +in + +{ + imports = [ ../../cgit ]; + + services.cgit.instances.spectrum = { + vhost = "spectrum-os.org"; + path = "/git"; + config = pkgs.writeText "cgit.conf" '' + clone-prefix=https://spectrum-os.org/git + css=/git/cgit.css + enable-blame=1 + enable-commit-graph=1 + enable-follow-links=1 + enable-git-config=1 + enable-index-owner=0 + enable-log-filecount=1 + enable-log-linecount=1 + footer=${cgitFooter} + remove-suffix=1 + root-desc=Web interface for Spectrum source code + root-readme=${spectrumReadme} + root-title=Spectrum Git Repository Browser + snapshots=all + about-filter=${pkgs.cgit}/lib/cgit/filters/about-formatting.sh + source-filter=${sourceFilter}/bin/syntax-highlighting.py + + scan-path=/home/spectrum/git + ''; + }; +} diff --git a/modules/server/spectrum/default.nix b/modules/server/spectrum/default.nix index c4a8ac962a85..1c7eda3181a8 100644 --- a/modules/server/spectrum/default.nix +++ b/modules/server/spectrum/default.nix @@ -1,5 +1,5 @@ { ... }: { - imports = [ ./nginx ./public-inbox ./tor ]; + imports = [ ./cgit ./nginx ./public-inbox ./tor ]; } |