diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-01-02 09:07:35 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-01-02 10:26:19 +0000 |
commit | 8b23c50a54ad5028d72edef8ae39e5153b54c3bf (patch) | |
tree | 6764ec9b2d8171f31ab5bf5f13a35d48266dd22e /modules/server/spectrum/cgit/default.nix | |
parent | 7b89d60ddb6bca484bfa3358ddd3dd1c8239252a (diff) | |
download | nixlib-8b23c50a54ad5028d72edef8ae39e5153b54c3bf.tar nixlib-8b23c50a54ad5028d72edef8ae39e5153b54c3bf.tar.gz nixlib-8b23c50a54ad5028d72edef8ae39e5153b54c3bf.tar.bz2 nixlib-8b23c50a54ad5028d72edef8ae39e5153b54c3bf.tar.lz nixlib-8b23c50a54ad5028d72edef8ae39e5153b54c3bf.tar.xz nixlib-8b23c50a54ad5028d72edef8ae39e5153b54c3bf.tar.zst nixlib-8b23c50a54ad5028d72edef8ae39e5153b54c3bf.zip |
modules/spectrum/cgit: init
It's very good to finally have this out of sys/atuin.nix.
Diffstat (limited to 'modules/server/spectrum/cgit/default.nix')
-rw-r--r-- | modules/server/spectrum/cgit/default.nix | 60 |
1 files changed, 60 insertions, 0 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 + ''; + }; +} |