aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2020-12-31 15:16:52 +0100
committerKatharina Fey <kookie@spacekookie.de>2020-12-31 16:52:07 +0100
commit51970440a767f3906bcb69cc3d00185391c5d595 (patch)
tree1469d36232518900577604de9e3dc5cd3acb1d49 /infra/libkookie
parent1d8f1df4a395fd69d20f6c172c78ca08070d0fa3 (diff)
libkookie: cgit: add patch to render recursive READMEs
Diffstat (limited to 'infra/libkookie')
-rw-r--r--infra/libkookie/overlays/default.nix12
-rw-r--r--infra/libkookie/overlays/patches/cgit/0001-recursive-readme.patch48
-rw-r--r--infra/libkookie/overlays/patches/cgit/default.nix12
3 files changed, 68 insertions, 4 deletions
diff --git a/infra/libkookie/overlays/default.nix b/infra/libkookie/overlays/default.nix
index c632570bfd43..69975660b097 100644
--- a/infra/libkookie/overlays/default.nix
+++ b/infra/libkookie/overlays/default.nix
@@ -7,16 +7,20 @@
self: super: {
+ ## Custom packages (previously kookiepkgs)
barrel-blog = self.callPackage ./kookie/barrel-blog { inherit (super); };
brook-frontend = self.callPackage ./kookie/brook-frontend { inherit (super); };
invoice = self.callPackage ./kookie/invoice { inherit (super); };
- spacekookie-de = self.callPackage ./kookie/spacekookie-de { inherit (super); };
libkookie-emacs = self.callPackage ./kookie/emacs { inherit (super); };
-
+ spacekookie-de = self.callPackage ./kookie/spacekookie-de { inherit (super); };
+
+ ## Packages to-be-upstreamed
+ foo2zjs = self.callPackage ./staging/foo2zjs { };
nodemcu-uploader = self.callPackage ./staging/nodemcu-uploader { };
pleroma = self.callPackage ./staging/pleroma { };
- foo2zjs = self.callPackage ./staging/foo2zjs { };
-
+
+ ## Override packages from nixpkgs
+ cgit = self.callPackage ./patches/cgit { inherit (super) cgit; };
htop = self.callPackage ./patches/htop { inherit (super) htop; };
iosevka = self.callPackage ./patches/iosevka { inherit (super) iosevka; };
}
diff --git a/infra/libkookie/overlays/patches/cgit/0001-recursive-readme.patch b/infra/libkookie/overlays/patches/cgit/0001-recursive-readme.patch
new file mode 100644
index 000000000000..417536644727
--- /dev/null
+++ b/infra/libkookie/overlays/patches/cgit/0001-recursive-readme.patch
@@ -0,0 +1,48 @@
+From 0294eec9da79ba3bebf351c22d04c67b22dc920f Mon Sep 17 00:00:00 2001
+From: Vincent Ambo <tazjin@google.com>
+Date: Sat, 21 Dec 2019 22:58:19 +0000
+Subject: feat(third_party/cgit): Use README at each subtree
+
+This means that individual subtrees of a repository will also have
+their READMEs rendered on the about page, for example:
+
+ /foo/bar/README.md
+
+Will render on:
+
+ /about/foo/bar/
+
+This is useful for monorepo setups in which subtrees represent
+individual projects.
+---
+ third_party/cgit/ui-summary.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+(limited to 'third_party/cgit')
+
+diff --git a/ui-summary.c b/ui-summary.c
+index 947812a81..d1bb6a59f 100644
+--- a/ui-summary.c
++++ b/ui-summary.c
+@@ -128,6 +128,18 @@ void cgit_print_repo_readme(const char *path)
+ goto done;
+ }
+
++ /* Determine which file to serve by checking whether the given filename is
++ * already a valid file and otherwise appending the expected file name of
++ * the readme.
++ *
++ * If neither yield a valid file, the user gets a blank page. Could probably
++ * do with an error message in between there, but whatever.
++ */
++ if (path && ref && !cgit_ref_path_exists(filename, ref, 1)) {
++ filename = fmtalloc("%s/%s", path, ctx.repo->readme.items[0].string);
++ free_filename = 1;
++ }
++
+ /* Print the calculated readme, either from the git repo or from the
+ * filesystem, while applying the about-filter.
+ */
+--
+cgit v1.2.3
+
diff --git a/infra/libkookie/overlays/patches/cgit/default.nix b/infra/libkookie/overlays/patches/cgit/default.nix
new file mode 100644
index 000000000000..cddb7cf6a55e
--- /dev/null
+++ b/infra/libkookie/overlays/patches/cgit/default.nix
@@ -0,0 +1,12 @@
+/* CGIT README RENDERING CUSTOMISATION
+ *
+ * This patch makes it so that cgit will display readme files in about
+ * relative to the selected directory in the tree, making it so that
+ * sub-projects can be advertised more easily.
+ *
+ */
+{ cgit, ... }:
+
+cgit.overrideAttrs ({ patches ? [], ... }: {
+ patches = patches ++ [ ./0001-recursive-readme.patch ];
+})