From 5c48b43ae039dd8bbaf2668ed4ca071806009784 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 7 Dec 2023 11:08:15 +0100 Subject: [PATCH] Enable public-inbox at jungle.bsc.es/lists The public-inbox service fetches emails from the sourcehut mailing lists and displays them on the web. The idea is to reduce the dependency on external services and add a secondary storage for the mailing lists in case sourcehut goes down or changes the current free plans. The service is available in https://jungle.bsc.es/lists/ and is open to the public. It currently mirrors the bscpkgs and jungle mailing list. We also edited the CSS to improve the readability and have larger fonts by default. The service for public-inbox produced by NixOS is not well configured to fetch emails from an IMAP mail server, so we also manually edit the service file to enable the network. Reviewed-by: Aleix Roca Nonell --- m/hut/configuration.nix | 1 + m/hut/public-inbox.css | 79 +++++++++++++++++++++++++++++++++++++ m/hut/public-inbox.nix | 47 ++++++++++++++++++++++ web/content/lists/_index.md | 6 +++ 4 files changed, 133 insertions(+) create mode 100644 m/hut/public-inbox.css create mode 100644 m/hut/public-inbox.nix create mode 100644 web/content/lists/_index.md diff --git a/m/hut/configuration.nix b/m/hut/configuration.nix index d571053..5c8e39a 100644 --- a/m/hut/configuration.nix +++ b/m/hut/configuration.nix @@ -11,6 +11,7 @@ ./nfs.nix ./slurm-daemon.nix ./nix-serve.nix + ./public-inbox.nix #./pxe.nix ]; diff --git a/m/hut/public-inbox.css b/m/hut/public-inbox.css new file mode 100644 index 0000000..9d0367c --- /dev/null +++ b/m/hut/public-inbox.css @@ -0,0 +1,79 @@ +/* + * CC0-1.0 + * Dark color scheme using 216 web-safe colors, inspired + * somewhat by the default color scheme in mutt. + * It reduces eyestrain for me, and energy usage for all: + * https://en.wikipedia.org/wiki/Light-on-dark_color_scheme + */ + +* { + font-size: 14px; + font-family: monospace; +} + +pre { + white-space: pre-wrap; + padding: 10px; + background: #f5f5f5; +} + +hr { + margin: 30px 0; +} + +body { + max-width: 120ex; /* 120 columns wide */ + margin: 50px auto; +} + +/* + * Underlined links add visual noise which make them hard-to-read. + * Use colors to make them stand out, instead. + */ +a:link { + color: #007; + text-decoration: none; +} +a:visited { + color:#504; +} +a:hover { + text-decoration: underline; +} + +/* quoted text in emails gets a different color */ +*.q { color:gray } + +/* + * these may be used with cgit , too. + * (cgit uses
, public-inbox uses ) + */ +*.add { color:darkgreen } /* diff post-image lines */ +*.del { color:darkred } /* diff pre-image lines */ +*.head { color:black } /* diff header (metainformation) */ +*.hunk { color:gray } /* diff hunk-header */ + +/* + * highlight 3.x colors (tested 3.18) for displaying blobs. + * This doesn't use most of the colors available, as I find too + * many colors overwhelming, so the default is commented out. + */ +.hl.num { color:#f30 } /* number */ +.hl.esc { color:#f0f } /* escape character */ +.hl.str { color:#f30 } /* string */ +.hl.ppc { color:#f0f } /* preprocessor */ +.hl.pps { color:#f30 } /* preprocessor string */ +.hl.slc { color:#09f } /* single-line comment */ +.hl.com { color:#09f } /* multi-line comment */ +/* .hl.opt { color:#ccc } */ /* operator */ +/* .hl.ipl { color:#ccc } */ /* interpolation */ + +/* keyword groups kw[a-z] */ +.hl.kwa { color:#ff0 } +.hl.kwb { color:#0f0 } +.hl.kwc { color:#ff0 } +/* .hl.kwd { color:#ccc } */ + +/* line-number (unused by public-inbox) */ +/* .hl.lin { color:#ccc } */ + diff --git a/m/hut/public-inbox.nix b/m/hut/public-inbox.nix new file mode 100644 index 0000000..a3d7a67 --- /dev/null +++ b/m/hut/public-inbox.nix @@ -0,0 +1,47 @@ +{ lib, ... }: + +{ + services.public-inbox = { + enable = true; + http = { + enable = true; + port = 8081; + mounts = [ "/lists" ]; + }; + settings.publicinbox = { + css = [ "${./public-inbox.css}" ]; + wwwlisting = "all"; + }; + inboxes = { + bscpkgs = { + url = "https://jungle.bsc.es/lists/bscpkgs"; + address = [ "~rodarima/bscpkgs@lists.sr.ht" ]; + watch = [ "imaps://jungle-robot%40gmx.com@imap.gmx.com/INBOX" ]; + description = "Patches for bscpkgs"; + listid = "~rodarima/bscpkgs.lists.sr.ht"; + }; + jungle = { + url = "https://jungle.bsc.es/lists/jungle"; + address = [ "~rodarima/jungle@lists.sr.ht" ]; + watch = [ "imaps://jungle-robot%40gmx.com@imap.gmx.com/INBOX" ]; + description = "Patches for jungle"; + listid = "~rodarima/jungle.lists.sr.ht"; + }; + }; + }; + + # We need access to the network for the watch service, as we will fetch the + # emails directly from the IMAP server. + systemd.services.public-inbox-watch.serviceConfig = { + PrivateNetwork = lib.mkForce false; + RestrictAddressFamilies = lib.mkForce [ "AF_UNIX" "AF_INET" "AF_INET6" ]; + KillSignal = "SIGKILL"; # Avoid slow shutdown + + # Required for chmod(..., 02750) on directories by git, from + # systemd.exec(8): + # > Note that this restricts marking of any type of file system object with + # > these bits, including both regular files and directories (where the SGID + # > is a different meaning than for files, see documentation). + RestrictSUIDSGID = lib.mkForce false; + }; +} diff --git a/web/content/lists/_index.md b/web/content/lists/_index.md new file mode 100644 index 0000000..afd5c08 --- /dev/null +++ b/web/content/lists/_index.md @@ -0,0 +1,6 @@ +--- +title: "Lists" +description: "Mailing lists" +--- + +If you are reading this page, the proxy to the public-inbox service is not working.