yep, more dotfiles
1{ pkgs
2, config
3, ...
4}:
5
6let
7 webfinger-dir = pkgs.writeTextDir ".well-known/webfinger" ''
8 {
9 "subject": "acct:milo@wiro.world",
10 "aliases": [
11 "mailto:milo@wiro.world",
12 "https://wiro.world/"
13 ],
14 "links": [
15 {
16 "rel": "http://wiro.world/rel/avatar",
17 "href": "https://wiro.world/logo.jpg",
18 "type": "image/jpeg"
19 },
20 {
21 "rel": "http://webfinger.net/rel/profile-page",
22 "href": "https://wiro.world/",
23 "type": "text/html"
24 },
25 {
26 "rel": "http://openid.net/specs/connect/1.0/issuer",
27 "href": "https://auth.wiro.world"
28 }
29 ]
30 }
31 '';
32
33 well-known-discord-dir = pkgs.writeTextDir ".well-known/discord" ''
34 dh=919234284ceb2aba439d15b9136073eb2308989b
35 '';
36
37 website-hostname = "wiro.world";
38in
39{
40 config = {
41 services.caddy = {
42 virtualHosts.${website-hostname}.extraConfig = ''
43 @webfinger {
44 path /.well-known/webfinger
45 method GET HEAD
46 query resource=acct:milo@wiro.world
47 query resource=mailto:milo@wiro.world
48 query resource=https://wiro.world
49 query resource=https://wiro.world/
50 }
51 route @webfinger {
52 header {
53 Content-Type "application/jrd+json"
54 Access-Control-Allow-Origin "*"
55 X-Robots-Tag "noindex"
56 }
57 root ${webfinger-dir}
58 file_server
59 }
60 '' +
61 ''
62 @discord {
63 path /.well-known/discord
64 method GET HEAD
65 }
66 route @discord {
67 header {
68 Access-Control-Allow-Origin "*"
69 X-Robots-Tag "noindex"
70 }
71 root ${well-known-discord-dir}
72 file_server
73 }
74 '';
75 };
76 };
77}