Move static websites from hetznix to nixedo

This commit is contained in:
Oliver Davies 2025-04-18 18:28:17 +01:00
parent c2e4f80364
commit ebf9778b42
24 changed files with 211 additions and 257 deletions

View file

@ -1,5 +0,0 @@
{
services.caddy.enable = true;
imports = [ ./vhosts ];
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."bootstrap-with-tailwind.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/bootstrap-with-tailwind.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,18 +0,0 @@
{
imports = [
./bootstrap-with-tailwind.oliverdavies.uk.nix
./eric.nix
./florida-drupalcamp-tailwind-css.oliverdavies.uk.nix
./luke.oliverdavies.uk.nix
./phpsw-sculpin-demo.oliverdavies.uk.nix
./rebuilding-acquia.oliverdavies.uk.nix
./rebuilding-bartik.oliverdavies.uk.nix
./rebuilding-bristol-js.oliverdavies.uk.nix
./rebuilding-symfony.oliverdavies.uk.nix
./tailwindcss-demo.oliverdavies.uk.nix
./talking-drupal-tailwindcss.oliverdavies.uk.nix
./wp-tailwind.oliverdavies.uk.nix
./www.oliverdavies.uk.nix
./zet.oliverdavies.uk.nix
];
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."eric.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/eric
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."florida-drupalcamp-tailwind-css.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/florida-drupalcamp-tailwind-css.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."luke.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/luke.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."phpsw-sculpin-demo.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/phpsw-sculpin-demo.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."rebuilding-acquia.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/rebuilding-acquia.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."rebuilding-bartik.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/rebuilding-bartik.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."rebuilding-bristol-js.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/rebuilding-bristol-js.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."rebuilding-symfony.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/rebuilding-symfony.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."tailwindcss-demo.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/tailwindcss-demo.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."talking-drupal-tailwindcss.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/talking-drupal-tailwindcss.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."wp-tailwind.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/wp-tailwind.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,71 +0,0 @@
{
services.caddy.virtualHosts = {
"oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
redir https://www.oliverdavies.uk{uri}
'';
};
"www.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig =
let
tomePaths = [
"core"
"sites/default/files"
"themes/custom/opdavies"
"tome-test"
];
tomeConfig = builtins.concatStringsSep "\n\n" (
builtins.map (path: ''
handle /${path} {
root * /var/www/vhosts/www.oliverdavies.uk-tome
file_server
}
handle_path /${path}/* {
root * /var/www/vhosts/www.oliverdavies.uk-tome/${path}
file_server
}
'') tomePaths
);
redirects = import ./www.oliverdavies.uk-redirects.nix;
redirectLines = builtins.concatStringsSep "\n" (
map (r: "redir ${r.from} ${r.to} permanent") redirects
);
in
''
encode gzip
file_server
root * /var/www/vhosts/www.oliverdavies.uk-sculpin
handle_errors {
@404 {
expression {http.error.status_code} == 404
}
rewrite @404 /404/index.html
file_server
}
${tomeConfig}
@articles path_regexp ^/articles/(.*)$
@talks path_regexp ^/talks/(.*)$
@talks-archive path_regexp ^/talks/archive/(.*)$
redir @articles /blog/{re.1} permanent
redir @talks-archive /presentations/{re.1} permanent
redir @talks /presentations/{re.1} permanent
${redirectLines}
'';
};
};
}

View file

@ -1,12 +0,0 @@
{
services.caddy.virtualHosts."zet.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = ''
encode gzip
root * /var/www/vhosts/zet.oliverdavies.uk
file_server
header X-Robots-Tag "noindex, nofollow"
'';
};
}

View file

@ -1,6 +1,5 @@
{ {
imports = [ imports = [
./caddy
./jitsi.nix ./jitsi.nix
./openssl.nix ./openssl.nix
]; ];

View file

@ -8,7 +8,6 @@
imports = with inputs.self.nixosModules; [ imports = with inputs.self.nixosModules; [
./hardware-configuration.nix ./hardware-configuration.nix
./secrets.nix ./secrets.nix
./services.nix
mixins-common mixins-common
mixins-docker mixins-docker
@ -25,6 +24,7 @@
./modules/forgejo.nix ./modules/forgejo.nix
./modules/immich.nix ./modules/immich.nix
./modules/jellyfin.nix ./modules/jellyfin.nix
./modules/nginx
./modules/paperless.nix ./modules/paperless.nix
]; ];

View file

@ -7,10 +7,6 @@
tunnels."e1514105-327f-4984-974e-e2fbaca76466" = { tunnels."e1514105-327f-4984-974e-e2fbaca76466" = {
credentialsFile = config.age.secrets.cloudflared.path; credentialsFile = config.age.secrets.cloudflared.path;
default = "http_status:404"; default = "http_status:404";
ingress = {
"bootstrap-with-tailwind.oliverdavies.uk" = "http://localhost:8000";
};
}; };
}; };
} }

View file

@ -0,0 +1,51 @@
let
sites = import ./sites.nix;
in
{
services = {
nginx = {
enable = true;
virtualHosts = builtins.listToAttrs (
map (site: {
name = site.url;
value = {
root = site.root;
listen = [
{
addr = "localhost";
port = site.port;
}
];
locations."/".tryFiles = "$uri $uri/index.html =404";
extraConfig = builtins.concatStringsSep "\n\n" [
site.extraConfig or ""
''
port_in_redirect off;
# Remove trailing slashes.
rewrite ^/(.*)/$ /$1 permanent;
''
];
};
}) sites
);
};
cloudflared.tunnels."e1514105-327f-4984-974e-e2fbaca76466" = {
ingress = builtins.listToAttrs (
map (site: {
name = site.url;
value = "http://localhost:${toString site.port}";
}) sites
);
};
};
imports = [ ./www.oliverdavies.uk.nix ];
}

View file

@ -0,0 +1,87 @@
[
{
url = "bootstrap-with-tailwind.oliverdavies.uk";
root = "/var/www/bootstrap-with-tailwind";
port = 8081;
}
{
port = 8084;
root = "/var/www/eric";
url = "eric.oliverdavies.uk";
extraConfig = ''
add_header X-Robots-Tag "noindex, nofollow";
'';
}
{
port = 8083;
root = "/var/www/florida-drupalcamp-tailwind-css";
url = "florida-drupalcamp-tailwind-css.oliverdavies.uk";
}
{
port = 8094;
root = "/var/www/luke";
url = "luke.oliverdavies.uk";
extraConfig = ''
add_header X-Robots-Tag "noindex, nofollow";
'';
}
{
port = 8085;
root = "/var/www/phpsw-sculpin-demo";
url = "phpsw-sculpin-demo.oliverdavies.uk";
}
{
port = 8086;
root = "/var/www/rebuilding-acquia";
url = "rebuilding-acquia.oliverdavies.uk";
}
{
port = 8087;
root = "/var/www/rebuilding-bartik";
url = "rebuilding-bartik.oliverdavies.uk";
}
{
port = 8088;
root = "/var/www/rebuilding-bristol-js";
url = "rebuilding-bristol-js.oliverdavies.uk";
}
{
port = 8089;
root = "/var/www/rebuilding-symfony";
url = "rebuilding-symfony.oliverdavies.uk";
}
{
port = 8090;
root = "/var/www/tailwindcss-demo";
url = "tailwindcss-demo.oliverdavies.uk";
}
{
port = 8091;
root = "/var/www/wp-tailwind";
url = "wp-tailwind.oliverdavies.uk";
}
{
port = 8092;
root = "/var/www/zet";
url = "zet.oliverdavies.uk";
}
{
port = 8093;
root = "/var/www/talking-drupal-tailwindcss";
url = "talking-drupal-tailwindcss.oliverdavies.uk";
}
]

View file

@ -0,0 +1,72 @@
let
port = 8095;
redirects = import ./www.oliverdavies.uk-redirects.nix;
redirectLines = builtins.concatStringsSep "\n" (
map (r: "rewrite ^${r.from}/?$ ${r.to} redirect;") redirects
);
tomePaths = [
"core"
"sites/default/files"
"themes/custom/opdavies"
"tome-test"
];
tomeLocations = builtins.listToAttrs (
map (path: {
name = "/${path}";
value = {
root = "/var/www/website-tome";
tryFiles = "$uri $uri.html $uri/index.html =404";
};
}) tomePaths
);
in
{
services = {
nginx.virtualHosts = {
"www.oliverdavies.uk" = {
root = "/var/www/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;
${redirectLines}
'';
};
"oliverdavies.uk".globalRedirect = "www.oliverdavies.uk";
};
cloudflared.tunnels."e1514105-327f-4984-974e-e2fbaca76466" = {
ingress = {
"oliverdavies.uk" = "http://localhost:${toString port}";
"www.oliverdavies.uk" = "http://localhost:${toString port}";
};
};
};
}

View file

@ -1,6 +1,5 @@
{ {
services = { services = {
caddy.enable = true;
openssh.enable = true; openssh.enable = true;
}; };
} }