Migrate oliverdavies.uk
This commit is contained in:
parent
17be52b377
commit
465494f400
4 changed files with 3178 additions and 4 deletions
|
|
@ -50,8 +50,4 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.${config.services.nginx.user}.extraGroups = [ "acme" ];
|
users.users.${config.services.nginx.user}.extraGroups = [ "acme" ];
|
||||||
|
|
||||||
imports = [
|
|
||||||
./oliverdavies.uk
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
imports = with inputs.self.modules.nixos; [
|
imports = with inputs.self.modules.nixos; [
|
||||||
inputs.agenix.nixosModules.default
|
inputs.agenix.nixosModules.default
|
||||||
|
|
||||||
|
nginx-oliverdavies-uk
|
||||||
nginx-ponthir-taekwondo
|
nginx-ponthir-taekwondo
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
3074
modules/server/home02/oliverdavies-uk/_redirects.nix
Normal file
3074
modules/server/home02/oliverdavies-uk/_redirects.nix
Normal file
File diff suppressed because it is too large
Load diff
103
modules/server/home02/oliverdavies-uk/default.nix
Normal file
103
modules/server/home02/oliverdavies-uk/default.nix
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
{
|
||||||
|
flake.modules.nixos.nginx-oliverdavies-uk =
|
||||||
|
{ config, ... }:
|
||||||
|
let
|
||||||
|
domain = "oliverdavies.uk";
|
||||||
|
port = 9098;
|
||||||
|
|
||||||
|
redirects = builtins.concatStringsSep "\n" (
|
||||||
|
map (r: "rewrite ^${r.from}/?$ ${r.to} redirect;") (import ./_redirects.nix)
|
||||||
|
);
|
||||||
|
|
||||||
|
tome = {
|
||||||
|
root = "/var/www/vhosts/website-tome";
|
||||||
|
|
||||||
|
paths = [
|
||||||
|
"core"
|
||||||
|
"sites/default/files"
|
||||||
|
"themes/custom/opdavies"
|
||||||
|
|
||||||
|
# TODO: move back to Sculpin.
|
||||||
|
"archive"
|
||||||
|
"automated-testing"
|
||||||
|
"daily/.+"
|
||||||
|
"examples"
|
||||||
|
"homelab"
|
||||||
|
"podcast"
|
||||||
|
"rss/bb.xml"
|
||||||
|
"rss/daily.xml"
|
||||||
|
"testing"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
tomeLocations = builtins.listToAttrs (
|
||||||
|
map (path: {
|
||||||
|
name = "~ ^/${path}";
|
||||||
|
|
||||||
|
value = {
|
||||||
|
root = tome.root;
|
||||||
|
tryFiles = "$uri $uri.html $uri/index.html =404";
|
||||||
|
};
|
||||||
|
}) tome.paths
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
security.acme = {
|
||||||
|
acceptTerms = true;
|
||||||
|
|
||||||
|
certs.${domain} = {
|
||||||
|
dnsProvider = "cloudflare";
|
||||||
|
domain = "${domain}";
|
||||||
|
email = "oliver@oliverdavies.uk";
|
||||||
|
environmentFile = config.age.secrets.cloudflare.path;
|
||||||
|
extraDomainNames = [ "www.${domain}" ];
|
||||||
|
webroot = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
virtualHosts."www.${domain}" = {
|
||||||
|
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}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.cloudflared = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
tunnels."c1537889-81ac-4d41-b80d-9657f8db30c7" = {
|
||||||
|
credentialsFile = config.age.secrets.cloudflared.path;
|
||||||
|
default = "http_status:404";
|
||||||
|
ingress."www.${domain}" = "http://localhost:${toString port}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue