fix(tazjin/nixos): set rad.tazj.in as preferred seed in explorer

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>
This commit is contained in:
Vincent Ambo 2024-09-15 02:57:17 +03:00 committed by clbot
parent 767bc726ef
commit 10c2866ccd
2 changed files with 29 additions and 4 deletions

View file

@ -2,7 +2,7 @@
# #
# They have an upstream Nix derivation, but it only works with experimental # 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. # features Nix and is quite messy, so this is a copy of the relevant parts.
{ pkgs, ... }: { lib, pkgs, ... }:
let let
twemoji-assets = pkgs.fetchFromGitHub { twemoji-assets = pkgs.fetchFromGitHub {
@ -14,7 +14,7 @@ let
httpdSrc = pkgs.radicle-httpd.src; httpdSrc = pkgs.radicle-httpd.src;
in in
pkgs.buildNpmPackage rec { lib.fix (self: pkgs.buildNpmPackage rec {
pname = "radicle-explorer"; pname = "radicle-explorer";
version = (builtins.fromJSON (builtins.readFile "${src}/package.json")).version; version = (builtins.fromJSON (builtins.readFile "${src}/package.json")).version;
@ -44,4 +44,19 @@ pkgs.buildNpmPackage rec {
runHook postInstall 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
'';
});
})

View file

@ -270,9 +270,13 @@ in
services.nginx.virtualHosts."src.tazj.in" = { services.nginx.virtualHosts."src.tazj.in" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
root = depot.third_party.radicle-explorer.withPreferredSeeds [{
hostname = "rad.tazj.in";
port = 443;
scheme = "https";
}];
locations."/" = { locations."/" = {
root = depot.third_party.radicle-explorer;
index = "index.html"; index = "index.html";
extraConfig = '' extraConfig = ''
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
@ -283,6 +287,12 @@ in
services.nginx.virtualHosts."src.y.tazj.in" = { services.nginx.virtualHosts."src.y.tazj.in" = {
enableSSL = true; enableSSL = true;
useACMEHost = "y.tazj.in"; useACMEHost = "y.tazj.in";
root = depot.third_party.radicle-explorer.withPreferredSeeds [{
hostname = "rad.y.tazj.in";
port = 443;
scheme = "https";
}];
locations = config.services.nginx.virtualHosts."src.tazj.in".locations; locations = config.services.nginx.virtualHosts."src.tazj.in".locations;
}; };