+*** Public Inbox
+This is my mailing list software that I will use to develop software.
+#+begin_src nix :tangle ../nix/modules/public_inbox.nix
+ { lib, config, ... }:
+ {
+ systemd.tmpfiles.rules = [
+ "C+ /var/lib/public-inbox/style.css 0644 public-inbox public-inbox - ${../data/public-inbox.css}"
+ ];
+ systemd.services.public-inbox-httpd = if config.monorepo.profiles.server.enable then {
+ preStart = ''
+ # Copy or link the file.
+ # Using 'cp' is often safer for sandboxed services than linking to the store. Lol.
+ cp -f ${../data/public-inbox.css} /var/lib/public-inbox/style.css
+ chmod 644 /var/lib/public-inbox/style.css
+ '';
+
+ serviceConfig = {
+ # Allow the service to see the file it just created
+ BindPaths = [
+ "/var/lib/public-inbox"
+ ];
+ ReadOnlyPaths = [ "/var/lib/public-inbox/style.css" ];
+ # Ensure it can actually write to the directory during preStart
+ ReadWritePaths = [ "/var/lib/public-inbox" ];
+ };
+ } else {};
+
+ systemd.services.public-inbox-watch = if config.monorepo.profiles.server.enable then {
+ after = [ "sops-nix.service" ];
+ confinement.enable = lib.mkForce false;
+ preStart = ''
+ mkdir -p /var/lib/public-inbox/.tmp
+ chmod 0700 /var/lib/public-inbox/.tmp
+ ln -sfn ${config.sops.templates."public-inbox-netrc".path} /var/lib/public-inbox/.netrc
+ '';
+ environment = {
+ PUBLIC_INBOX_FORCE_IPV4 = "1";
+ NETRC = config.sops.templates."public-inbox-netrc".path;
+ HOME = "/var/lib/public-inbox";
+ TMPDIR = "/var/lib/public-inbox/.tmp";
+ };
+
+ serviceConfig = {
+ RestrictSUIDSGID = lib.mkForce false;
+ ReadWritePaths = [ "/var/lib/public-inbox" ];
+ RestrictAddressFamilies = lib.mkForce [ "AF_UNIX" "AF_INET" "AF_INET6" ];
+ PrivateNetwork = lib.mkForce false;
+ SystemCallFilter = lib.mkForce [];
+ RootDirectory = lib.mkForce "";
+
+ CapabilityBoundingSet = lib.mkForce [ "~" ];
+ UMask = lib.mkForce "0022";
+ ProtectSystem = lib.mkForce false;
+ };
+ } else {};
+
+ services.public-inbox = {
+ enable = lib.mkDefault config.monorepo.profiles.server.enable;
+ settings = {
+ publicinbox.css = ["/var/lib/public-inbox/style.css"];
+ publicinbox.wwwlisting = "all";
+ };
+ http = {
+ enable = true;
+ port = 9090;
+ };
+ inboxes = {
+ "monorepo" = {
+ description = "discussion of ret2pop's monorepo project and related work.";
+ address = [ "monorepo@${config.monorepo.vars.orgHost}" ];
+ inboxdir = "/var/lib/public-inbox/monorepo";
+ url = "https://list.${config.monorepo.vars.orgHost}/monorepo";
+ watch = [ "imaps://monorepo%40${config.monorepo.vars.orgHost}@mail.${config.monorepo.vars.orgHost}/INBOX" ];
+ };
+
+ "discussion" = {
+ description = "Main Nullring Discussion Mailing List";
+ address = [ "discussion@${config.monorepo.vars.orgHost}" ];
+ inboxdir = "/var/lib/public-inbox/discuss";
+ url = "https://list.${config.monorepo.vars.orgHost}/discussion";
+ watch = [ "imaps://discussion%40${config.monorepo.vars.orgHost}@mail.${config.monorepo.vars.orgHost}/INBOX" ];
+ };
+ };
+ };
+ }
+#+end_src
+*** Public Inbox CSS
+This is a minimal stylesheet for public inbox so that I don't get eye cancer while reading it.
+#+begin_src nix :tangle ../nix/data/public-inbox.css
+ :root {
+ --bg: #f8f9fa;
+ --fg: #2e3440;
+ --link: #5e81ac;
+ --link-hover: #81a1c1;
+ --border: #d8dee9;
+ --card-bg: #ffffff;
+ --meta-fg: #4c566a; /* Darker gray for better legibility */
+ --btn-fg: #ffffff;
+ --max-width: 780px;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ :root {
+ --bg: #1a1b26;
+ --fg: #a9b1d6;
+ --link: #7aa2f7;
+ --link-hover: #bb9af7;
+ --border: #414868; /* Distinct border for dark mode */
+ --card-bg: #1f2335;
+ --meta-fg: #9aa5ce; /* Brighter gray for dark mode */
+ --btn-fg: #1a1b26;
+ }
+ }
+
+ span.q {
+ color: var(--meta-fg);
+ font-style: italic;
+ }
+
+ body {
+ background-color: var(--bg);
+ color: var(--fg);
+ line-height: 1.6;
+ max-width: var(--max-width);
+ margin: 3rem auto;
+ padding: 0 1.5rem;
+ font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
+
+ /* Keep this for smoother rendering on macOS/iOS */
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ }
+
+ /* 1. Global Link Fixes */
+ body a, body a:visited {
+ color: var(--link);
+ }
+
+ /* 2. Card Styling */
+ body pre {
+ white-space: pre-wrap;
+ background: var(--card-bg);
+ padding: 2rem;
+ border-radius: 12px;
+ border: 1px solid var(--border);
+ margin-bottom: 2.5rem;
+ }
+
+ /* 3. Header Cleanup */
+ body pre b:first-of-type {
+ font-weight: 700;
+ color: var(--link);
+ font-size: 1.1rem;
+ display: block;
+ margin-bottom: 0.5rem;
+ }
+
+ /* 4. Fixing the "Permalink" label on documentation */
+ /* We target links ending in / but EXCLUDE system paths like help or mirror */
+ body pre a[href$="/"]:not([href*="_/"]):not([href*="new.atom"]) {
+ font-size: 0;
+ text-decoration: none;
+ margin-right: 10px;
+ }
+
+ body pre a[href$="/"]:not([href*="_/"]):not([href*="new.atom"]):after {
+ content: "permalink";
+ font-size: 11px;
+ font-weight: bold;
+ color: var(--fg); /* Use main text color for high contrast */
+ background: var(--bg);
+ border: 1px solid var(--link); /* Use link color for the border */
+ padding: 4px 10px;
+ border-radius: 4px;
+ display: inline-block;
+ }
+
+ /* 5. Fixing the "Raw" button contrast */
+ body pre a[href$="/raw"] {
+ font-size: 0;
+ text-decoration: none;
+ }
+
+ body pre a[href$="/raw"]:after {
+ content: "raw";
+ font-size: 11px;
+ font-weight: bold;
+ color: var(--fg);
+ background: var(--bg);
+ border: 1px solid var(--link);
+ padding: 4px 10px;
+ border-radius: 4px;
+ display: inline-block;
+ }
+
+ /* Hover effect for ghost buttons: solid color shift */
+ body pre a[href$="/"]:hover:after,
+ body pre a[href$="/raw"]:hover:after {
+ background: var(--link);
+ color: var(--btn-fg);
+ }
+
+ /* 6. The Reply Button (Primary Action) */
+ body pre a[href$="#R"], body pre a[href$="#R"]:visited {
+ font-size: 0;
+ text-decoration: none;
+ }
+
+ body pre a[href$="#R"]:after {
+ content: "REPLY";
+ font-size: 12px;
+ font-weight: bold;
+ padding: 6px 20px;
+ background: var(--link);
+ color: var(--btn-fg);
+ border-radius: 6px;
+ display: inline-block;
+ margin-left: 10px;
+ }
+
+ /* 7. Hide clutter */
+ body pre a[href^="#r"], body pre a[href^="#r"] + b, body hr {
+ display: none;
+ }
+
+ /* Fix: Mathematically outscore the header rule to keep link text inline */
+ body pre a[href] b:first-of-type {
+ display: inline;
+ font-size: inherit;
+ margin-bottom: 0;
+ color: inherit;
+ }
+#+end_src