diff options
| author | Mel <einebeere@gmail.com> | 2025-02-11 19:08:58 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2025-02-11 19:08:58 +0100 |
| commit | 0fd0d31a33ddb24747b5887d5f44de0a54eb4e9d (patch) | |
| tree | 0eaf48df99811312f4a5221c537ac09be3602774 | |
| parent | 766dbd5d13b935fb5236e032e01c21f2706806de (diff) | |
| download | network-0fd0d31a33ddb24747b5887d5f44de0a54eb4e9d.tar.zst network-0fd0d31a33ddb24747b5887d5f44de0a54eb4e9d.zip | |
Define base HTML server page
Signed-off-by: Mel <einebeere@gmail.com>
| -rw-r--r-- | assets/base.html | 41 | ||||
| -rw-r--r-- | machines/renard/default.nix | 2 | ||||
| -rw-r--r-- | modules/www/default.nix | 20 | ||||
| -rw-r--r-- | modules/www/tailnet.nix | 3 |
4 files changed, 59 insertions, 7 deletions
diff --git a/assets/base.html b/assets/base.html new file mode 100644 index 0000000..baecbfa --- /dev/null +++ b/assets/base.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <link rel="shortcut icon" href="/favicon.png"> + <title>@me@</title> + <style> + html, + body { + margin: 0; + padding: 0; + height: 100%; + width: 100%; + } + + body { + font-family: monospace; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + } + + pre { + line-height: 0.75; + } + </style> + </head> + <body> + <pre> +/^ /^ <br> +\ ' ' 7 < Hi, I'm @me@ <br> +/ \ + </pre> + + <p>I'm <a href="https://mel.gg">Mel's</a> personal server.</p> + <p>Thanks for visiting! <3</p> + </body> +</html> diff --git a/machines/renard/default.nix b/machines/renard/default.nix index e5fc21f..0188340 100644 --- a/machines/renard/default.nix +++ b/machines/renard/default.nix @@ -30,7 +30,7 @@ }; services.nginx.virtualHosts = { - "rnrd.eu".locations = { + base.locations = { # redirect to akkoma on lapin "/.well-known/webfinger" = { return = "301 https://soc.rnrd.eu$request_uri"; diff --git a/modules/www/default.nix b/modules/www/default.nix index c82a00d..e2f07d6 100644 --- a/modules/www/default.nix +++ b/modules/www/default.nix @@ -1,7 +1,18 @@ -{ me, ... }: +{ me, pkgs, util, ... }: let rnrdUrl = if me.is.renard then "rnrd.eu" else "${me.name}.rnrd.eu"; + + base-index = pkgs.substituteAll { + src = ../../assets/base.html; + env.me = util.titleCase me.name; + }; + + base = pkgs.linkFarm "www-base" { + "index.html" = base-index; + "favicon.png" = ../../assets/favicon.png; + }; + in { imports = [ ./tailnet.nix ]; @@ -43,11 +54,10 @@ in ''; virtualHosts = { - default = { + base = { default = true; - }; - ${rnrdUrl} = { - root = "/var/www/html"; + serverName = rnrdUrl; + root = base; forceSSL = true; enableACME = true; extraConfig = '' diff --git a/modules/www/tailnet.nix b/modules/www/tailnet.nix index df70a55..8ef50cc 100644 --- a/modules/www/tailnet.nix +++ b/modules/www/tailnet.nix @@ -1,5 +1,6 @@ { me, + config, lib, pkgs, ... @@ -80,7 +81,7 @@ in listenAddresses = [ me.tailscale.ip ]; # point to the default page, for now! locations."/" = { - alias = "/var/www/html/"; + alias = "${config.services.nginx.virtualHosts.base.root}/"; }; extraConfig = '' access_log /var/log/nginx/tailnet.access.log json_combined; |
