nix-config/hosts/nixedo/modules/nginx/www.oliverdavies.uk/default.nix
Oliver Davies e62dfdde38
All checks were successful
/ check (push) Successful in 1m9s
Serve the new podcast episode from Tome
Now the Podcast Episode content type and the first episode node has been
created, serve the new episode from Tome.

It won't appear on the episode listing page at /podcast, but I'll
recreate that once I've migrated the existing episodes to Tome, or I can
manually add it to the listing page by editing the HTML rather than
re-generating the page with Sculpin as it would confuse the commit
history in this project - which I want to keep intact.
2025-05-23 11:07:38 +01:00

112 lines
2.4 KiB
Nix

{ config, ... }:
let
ports = config.homelab.ports;
port = ports.nginx-website-sculpin;
redirects = builtins.concatStringsSep "\n" (
map (r: "rewrite ^${r.from}/?$ ${r.to} redirect;") (import ./redirects.nix)
);
tome = {
root = "/var/www/vhosts/website-tome";
paths = [
"archive"
"core"
"daily/.+"
"examples"
"homelab"
"podcast/28-ai-tools-web-coding-luke-mccormick"
"rss/daily.xml"
"sites/default/files"
"themes/custom/opdavies"
"tome-test"
];
port = ports.nginx-website-tome;
};
tomeLocations = builtins.listToAttrs (
map (path: {
name = "~ ^/${path}";
value = {
root = tome.root;
tryFiles = "$uri $uri.html $uri/index.html =404";
};
}) tome.paths
);
in
{
services = {
nginx.virtualHosts = {
"www.oliverdavies.uk" = {
root = "/var/www/vhosts/website-sculpin";
listen = [
{
inherit port;
addr = "localhost";
}
];
locations = tomeLocations // {
"/".tryFiles = "$uri $uri.html $uri/index.html =404";
};
extraConfig = ''
port_in_redirect off;
# Remove trailing slashes.
rewrite ^/(.*)/$ /$1 permanent;
error_page 404 /404;
rewrite ^/talks/archive/?$ /talks permanent;
rewrite ^/talks/(.*)$ /presentations/$1 permanent;
rewrite ^/talks/?$ /presentations permanent;
${redirects}
'';
};
"oliverdavies.uk" = {
forceSSL = true;
globalRedirect = "www.oliverdavies.uk";
useACMEHost = "oliverdavies.uk";
};
"tome.oliverdavies.uk" = {
listen = [
{
addr = "localhost";
port = tome.port;
}
];
locations."/".tryFiles = "$uri $uri.html $uri/index.html =404";
root = tome.root;
extraConfig = ''
add_header X-Robots-Tag "noindex, nofollow";
port_in_redirect off;
# Remove trailing slashes.
rewrite ^/(.*)/$ /$1 permanent;
'';
};
};
cloudflared.tunnels."e1514105-327f-4984-974e-e2fbaca76466" = {
ingress = {
"oliverdavies.uk" = "http://localhost:${toString port}";
"tome.oliverdavies.uk" = "http://localhost:${toString tome.port}";
"www.oliverdavies.uk" = "http://localhost:${toString port}";
};
};
};
}