about summary refs log tree commit diff
path: root/third_party/radicle-explorer
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2024-09-14T23·57+0300
committerclbot <clbot@tvl.fyi>2024-09-15T00·18+0000
commit10c2866ccd61bedb9fe82f0a7f5284af91a301bd (patch)
tree8f4c29c5174b21b6b0002e5058e7287caaaaa299 /third_party/radicle-explorer
parent767bc726efa383561dd0805fc455672765ac7c8c (diff)
fix(tazjin/nixos): set rad.tazj.in as preferred seed in explorer r/8697
This requires overriding build-time configuration, so I've added a little fixed
point that takes care of that.

Change-Id: Ie990e362c6e00aa6e3be66b04af4b62034b03515
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12489
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'third_party/radicle-explorer')
-rw-r--r--third_party/radicle-explorer/default.nix21
1 files changed, 18 insertions, 3 deletions
diff --git a/third_party/radicle-explorer/default.nix b/third_party/radicle-explorer/default.nix
index 7fe9539ddf74..0241eaef5d3e 100644
--- a/third_party/radicle-explorer/default.nix
+++ b/third_party/radicle-explorer/default.nix
@@ -2,7 +2,7 @@
 #
 # They have an upstream Nix derivation, but it only works with experimental
 # features Nix and is quite messy, so this is a copy of the relevant parts.
-{ pkgs, ... }:
+{ lib, pkgs, ... }:
 
 let
   twemoji-assets = pkgs.fetchFromGitHub {
@@ -14,7 +14,7 @@ let
 
   httpdSrc = pkgs.radicle-httpd.src;
 in
-pkgs.buildNpmPackage rec {
+lib.fix (self: pkgs.buildNpmPackage rec {
   pname = "radicle-explorer";
   version = (builtins.fromJSON (builtins.readFile "${src}/package.json")).version;
 
@@ -44,4 +44,19 @@ pkgs.buildNpmPackage rec {
     runHook postInstall
   '';
 
-}
+  # Override the build-time configuration with other preferred seeds which are
+  # displayed on the landing page.
+  passthru.withPreferredSeeds = seeds:
+    let
+      originalConfig = builtins.fromJSON (builtins.readFile "${src}/config/default.json");
+      config = originalConfig // {
+        preferredSeeds = seeds;
+      };
+      newConfig = pkgs.writeText "local.json" (builtins.toJSON config);
+    in
+    self.overrideAttrs (_: {
+      preBuild = ''
+        cp ${newConfig} config/local.json
+      '';
+    });
+})