Home

infra @main - refs - log -
-
https://git.jolheiser.com/infra.git
dragonwell flake
tree log patch
dragonwell: move to services for readDir import and add config Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE----- U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 AAAAQOzyAze80cRXI8S6dr4Yt22Jj7iO5gWSm9sADnKexYWTMDV4bDf1JW7umHLuKV+H8p odpOr44GMesVLlwFra3Qg= -----END SSH SIGNATURE-----
jolheiser <git@jolheiser.com>
21 hours ago
26 changed files, 161 additions(+), 142 deletions(-)
config.nixdragonwell/services/atproto.nixdragonwell/services/beszel.nixdragonwell/services/caddy.nixdragonwell/default.nixdragonwell/services/forge-lines.nixdragonwell/services/foundry.nixdragonwell/services/git-bug.nixdragonwell/services/git-pr.nixdragonwell/go.nixdragonwell/services/gollum.nixdragonwell/services/horcrux.nixdragonwell/services/mealie.nixdragonwell/services/miniserve.nixdragonwell/services/mint.nixdragonwell/oa2p.nixdragonwell/services/pocket-id.nixdragonwell/services/pubserve.nixdragonwell/services/restic.nixdragonwell/services/go.nixdragonwell/services/oa2p.nixdragonwell/services/soju.nixdragonwell/services/ugit.nixdragonwell/services/woodpecker.nixdragonwell/services/zoekt.nixflake.nix
I config.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
diff --git a/config.nix b/config.nix
new file mode 100644
index 0000000000000000000000000000000000000000..05104fdac163f686a3c899a9a4af626b5bccd45b
--- /dev/null
+++ b/config.nix
@@ -0,0 +1,8 @@
+{
+  pkgs ? import <nixpkgs> { },
+}:
+{
+  username = "jolheiser";
+  sshKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+uhnfFLhlyfGGsksSxh5IIY6gnIMryeQ2EiM979kZa";
+  domain = "jolheiser.com";
+}
M dragonwell/atproto.nix -> dragonwell/services/atproto.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff --git a/dragonwell/atproto.nix b/dragonwell/services/atproto.nix
rename from dragonwell/atproto.nix
rename to dragonwell/services/atproto.nix
index 6e417feeead24caea4be1ccbaff2e4ffb13d8a8c..6fce0df7fd5ac6a358718aa40a892d7ebcfc899e 100644
--- a/dragonwell/atproto.nix
+++ b/dragonwell/services/atproto.nix
@@ -1,22 +1,23 @@
-{ config, ... }:
+{ jolheiser, config, ... }:
 let
   port = 2759;
+  host = "pds.${jolheiser.domain}";
 in
 {
-  age.secrets.pds.file = ../secrets/pds.age;
+  age.secrets.pds.file = ../../secrets/pds.age;
   services = {
     bluesky-pds = {
       enable = true;
       pdsadmin.enable = true;
       settings = {
         PDS_PORT = port;
-        PDS_HOSTNAME = "pds.jolheiser.com";
+        PDS_HOSTNAME = host;
       };
       environmentFiles = [
         config.age.secrets.pds.path
       ];
     };
-    caddy.virtualHosts."pds.jolheiser.com".extraConfig = ''
+    caddy.virtualHosts."${host}".extraConfig = ''
       reverse_proxy localhost:${builtins.toString port}
     '';
   };
M dragonwell/beszel.nix -> dragonwell/services/beszel.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
diff --git a/dragonwell/beszel.nix b/dragonwell/services/beszel.nix
rename from dragonwell/beszel.nix
rename to dragonwell/services/beszel.nix
index f63f49bcfda70d3f91dadb765983abc774d5de29..50ef37e7547039fcd3958e2d1d830d57ea69befb 100644
--- a/dragonwell/beszel.nix
+++ b/dragonwell/services/beszel.nix
@@ -1,6 +1,6 @@
 { config, ... }:
 {
-  age.secrets.beszel-dragonwell.file = ../secrets/beszel-dragonwell.age;
+  age.secrets.beszel-dragonwell.file = ../../secrets/beszel-dragonwell.age;
   services.beszel.agent = {
     enable = true;
     environment.LOG_LEVEL = "info";
M dragonwell/caddy.nix -> dragonwell/services/caddy.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
diff --git a/dragonwell/caddy.nix b/dragonwell/services/caddy.nix
rename from dragonwell/caddy.nix
rename to dragonwell/services/caddy.nix
index 2f4a48b902f7dbf70bdbc35ab0af754a04c6055c..9ce60f5f5fb74eb639fb470e6cd33cf1d8841aeb 100644
--- a/dragonwell/caddy.nix
+++ b/dragonwell/services/caddy.nix
@@ -1,19 +1,24 @@
-{ inputs, pkgs, ... }:
+{
+  jolheiser,
+  inputs,
+  pkgs,
+  ...
+}:
 {
   services.caddy = {
     enable = true;
     virtualHosts = {
-      "jolheiser.com" = {
+      "${jolheiser.domain}" = {
         extraConfig = ''
           handle_path /.well-known/webfinger {
             header Content-Type application/jrd+json
             respond ${
               builtins.toJSON {
-                subject = "acct:john@jolheiser.com";
+                subject = "acct:john@${jolheiser.domain}";
                 links = [
                   {
                     rel = "http://openid.net/specs/connect/1.0/issuer";
-                    href = "https://id.jolheiser.com";
+                    href = "https://id.${jolheiser.domain}";
                   }
                 ];
               }
@@ -33,15 +38,15 @@             root * ${inputs.website.packages.${pkgs.stdenv.hostPlatform.system}.default}
             file_server
           }
         '';
-        serverAliases = [ "www.jolheiser.com" ];
+        serverAliases = [ "www.${jolheiser.domain}" ];
       };
-      "blog.jolheiser.com" = {
+      "blog.${jolheiser.domain}" = {
         extraConfig = ''
           root * ${inputs.blog.packages.${pkgs.stdenv.hostPlatform.system}.default}
           file_server
         '';
       };
-      "dev.jolheiser.com".extraConfig = ''
+      "dev.${jolheiser.domain}".extraConfig = ''
         reverse_proxy localhost:3389
         handle_errors 502 503 504 {
           respond "No active tunnel"
M dragonwell/default.nix -> dragonwell/default.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
diff --git a/dragonwell/default.nix b/dragonwell/default.nix
index 3e37cf8e8780579020aecc4a08a5e96dcee26d74..738e174071e819dbcb9ab4563e9e4a907c3cc7ff 100644
--- a/dragonwell/default.nix
+++ b/dragonwell/default.nix
@@ -1,32 +1,8 @@
-let
-  username = "jolheiser";
-  key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+uhnfFLhlyfGGsksSxh5IIY6gnIMryeQ2EiM979kZa";
-in
+{ jolheiser, ... }:
 {
-  imports = [
-    ./atproto.nix
-    ./beszel.nix
-    ./caddy.nix
-    ./forge-lines.nix
-    ./foundry.nix
-    #./git-bug.nix
-    ./git-pr.nix
-    ./go.nix
-    ./gollum.nix
-    ./horcrux.nix
-    ./mealie.nix
-    ./miniserve.nix
-    ./mint.nix
-    ./oa2p.nix
-    ./pocket-id.nix
-    ./pubserve.nix
-    ./restic.nix
-    ./soju.nix
-    ./ugit.nix
-    ./woodpecker.nix
-    ./zoekt.nix
-    ./hardware.nix
-  ];
+  imports =
+    (map (name: ./services + "/${name}") (builtins.attrNames (builtins.readDir ./services)))
+    ++ [ ./hardware.nix ];
 
   boot.tmp.cleanOnBoot = true;
   zramSwap.enable = true;
@@ -53,16 +29,16 @@     fail2ban.enable = true;
   };
 
   users.users = {
-    "${username}" = {
+    "${jolheiser.username}" = {
       extraGroups = [
         "wheel"
         "docker"
         "storage"
       ];
       isNormalUser = true;
-      openssh.authorizedKeys.keys = [ key ];
+      openssh.authorizedKeys.keys = [ jolheiser.sshKey ];
     };
-    "root".openssh.authorizedKeys.keys = [ key ];
+    "root".openssh.authorizedKeys.keys = [ jolheiser.sshKey ];
   };
 
   nix = {
M dragonwell/forge-lines.nix -> dragonwell/services/forge-lines.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
diff --git a/dragonwell/forge-lines.nix b/dragonwell/services/forge-lines.nix
rename from dragonwell/forge-lines.nix
rename to dragonwell/services/forge-lines.nix
index 3e0345be7229b1c59cd8d56e6215fa0d0deb3a99..6faec823e772dfce32f9392c55196d6bcd0b673b 100644
--- a/dragonwell/forge-lines.nix
+++ b/dragonwell/services/forge-lines.nix
@@ -1,6 +1,6 @@
 { config, ... }:
 {
-  age.secrets.forge-lines.file = ../secrets/forge-lines.age;
+  age.secrets.forge-lines.file = ../../secrets/forge-lines.age;
   services.forge-lines = {
     enable = false;
     discordTokenFile = config.age.secrets.forge-lines.path;
M dragonwell/foundry.nix -> dragonwell/services/foundry.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
diff --git a/dragonwell/foundry.nix b/dragonwell/services/foundry.nix
rename from dragonwell/foundry.nix
rename to dragonwell/services/foundry.nix
index fce651798f88395091511064d599bc200b9b78f7..cafbf6dc9281dd8878f577434a44d2a91e84d758 100644
--- a/dragonwell/foundry.nix
+++ b/dragonwell/services/foundry.nix
@@ -1,20 +1,26 @@
-{ inputs, pkgs, ... }:
+{
+  jolheiser,
+  inputs,
+  pkgs,
+  ...
+}:
 let
   port = 30000;
+  host = "dnd.${jolheiser.domain}";
 in
 {
   services = {
     foundryvtt = {
       enable = true;
       inherit port;
-      hostName = "dnd.jolheiser.com";
+      hostName = host;
       minifyStaticFiles = true;
       proxyPort = 443;
       proxySSL = true;
       upnp = false;
       package = inputs.foundry.packages.${pkgs.stdenv.hostPlatform.system}.foundryvtt_14;
     };
-    caddy.virtualHosts."dnd.jolheiser.com".extraConfig = ''
+    caddy.virtualHosts."${host}".extraConfig = ''
       reverse_proxy localhost:${builtins.toString port}
     '';
   };
M dragonwell/git-bug.nix -> dragonwell/services/git-bug.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
diff --git a/dragonwell/git-bug.nix b/dragonwell/services/git-bug.nix
rename from dragonwell/git-bug.nix
rename to dragonwell/services/git-bug.nix
index 03021813b6386cf94b1695145150219615a739df..d5eb1f476da2d0be0f9817a7fdc498bbd4a86d5e 100644
--- a/dragonwell/git-bug.nix
+++ b/dragonwell/services/git-bug.nix
@@ -1,7 +1,9 @@
+{ lib, ... }:
 let
+  enable = false;
   port = 2847;
 in
-{
+lib.mkIf enable {
   services = {
     git-bug.bugs = {
       enable = false;
M dragonwell/git-pr.nix -> dragonwell/services/git-pr.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/dragonwell/git-pr.nix b/dragonwell/services/git-pr.nix
rename from dragonwell/git-pr.nix
rename to dragonwell/services/git-pr.nix
index 4f18805427e380469adea6acbec985cde41aea28..bbe8a374f5e3db430d9f25da437f4d70fd04f508 100644
--- a/dragonwell/git-pr.nix
+++ b/dragonwell/services/git-pr.nix
@@ -1,12 +1,14 @@
+{ jolheiser, ... }:
 let
   port = 7449;
+  host = "pr.${jolheiser.domain}";
 in
 {
   services = {
     git-pr = {
       enable = false;
       openFirewall = true;
-      url = "pr.jolheiser.com";
+      url = host;
       admins = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJXoiWcPkL5kUAqJfMxnPM/ND4qJ4kKShDhXdqnYv2ZB" ];
       sshPort = 7448;
       enableWeb = true;
@@ -26,7 +28,7 @@           desc = "Nix flake, package, and module for git-pr";
         }
       ];
     };
-    caddy.virtualHosts."pr.jolheiser.com".extraConfig = ''
+    caddy.virtualHosts."${host}".extraConfig = ''
       reverse_proxy localhost:${builtins.toString port}
     '';
   };
D dragonwell/go.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
diff --git a/dragonwell/go.nix b/dragonwell/go.nix
deleted file mode 100644
index e388f3a9dc0a0068896adce91bdba0dd89b22a6d..0000000000000000000000000000000000000000
--- a/dragonwell/go.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-let
-  altModules = [
-    {
-      name = "hcaptcha";
-      repo = "gitea.com/jolheiser/hcaptcha";
-    }
-    {
-      name = "pwn";
-      repo = "gitea.com/jolheiser/pwn";
-    }
-  ];
-  redirects = builtins.concatStringsSep "\n" (
-    builtins.map (module: ''
-      respond /${module.name}* `<html><head>
-                <meta name="go-import" content="go.jolheiser.com/${module.name} git https://${module.repo}.git">
-                <meta http-equiv="refresh" content="3; url=https://pkg.go.dev/go.jolheiser.com/${module.name}" />
-                </head><body>
-                Redirecting to <a href="https://pkg.go.dev/go.jolheiser.com/${module.name}">https://pkg.go.dev/go.jolheiser.com/${module.name}</a>
-                </body></html>`
-    '') altModules
-  );
-in
-{
-  services.caddy.virtualHosts."go.jolheiser.com" = {
-    extraConfig = ''
-      header Content-Type text/html
-      ${redirects}
-      respond /* `<html><head>
-        <meta name="go-import" content="go.jolheiser.com{path} git https://git.jolheiser.com{path}.git">
-        <meta http-equiv="refresh" content="3; url=https://pkg.go.dev/go.jolheiser.com{path}" />
-        </head><body>
-        Redirecting to <a href="https://pkg.go.dev/go.jolheiser.com{path}">https://pkg.go.dev/go.jolheiser.com{path}</a>
-        </body></html>`
-    '';
-  };
-}
M dragonwell/gollum.nix -> dragonwell/services/gollum.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff --git a/dragonwell/gollum.nix b/dragonwell/services/gollum.nix
rename from dragonwell/gollum.nix
rename to dragonwell/services/gollum.nix
index 0625aadc724edb60e39f7623c0c1ef044815ce69..9e060cc60cc97f08d51844b18c8b09759a806574 100644
--- a/dragonwell/gollum.nix
+++ b/dragonwell/services/gollum.nix
@@ -1,4 +1,9 @@
-{ pkgs, config, ... }:
+{
+  pkgs,
+  jolheiser,
+  config,
+  ...
+}:
 let
   port = 9454;
 in
@@ -14,7 +19,7 @@       branch = "main";
       user = "ugit";
       group = "ugit";
     };
-    caddy.virtualHosts."wiki.jolheiser.com".extraConfig = ''
+    caddy.virtualHosts."wiki.${jolheiser.domain}".extraConfig = ''
       	handle /oauth2/* {
       		reverse_proxy localhost:6227 {
       			header_up X-Real-IP {remote_host}
M dragonwell/horcrux.nix -> dragonwell/services/horcrux.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
diff --git a/dragonwell/horcrux.nix b/dragonwell/services/horcrux.nix
rename from dragonwell/horcrux.nix
rename to dragonwell/services/horcrux.nix
index 5274732d82d122c3aec34991e4fb2f031eccb63b..de6b52d4a1bdd835c21f95463491f32601fb03e2 100644
--- a/dragonwell/horcrux.nix
+++ b/dragonwell/services/horcrux.nix
@@ -1,7 +1,7 @@
 { config, ... }:
 {
   age.secrets.horcrux = {
-    file = ../secrets/horcrux.age;
+    file = ../../secrets/horcrux.age;
     owner = "horcrux";
   };
   services.horcrux = {
M dragonwell/mealie.nix -> dragonwell/services/mealie.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
diff --git a/dragonwell/mealie.nix b/dragonwell/services/mealie.nix
rename from dragonwell/mealie.nix
rename to dragonwell/services/mealie.nix
index d397f55d222a19c4506ad493c4bd6f16f704d508..b67b2443a03498534f7d1906675c79d1047c748f 100644
--- a/dragonwell/mealie.nix
+++ b/dragonwell/services/mealie.nix
@@ -1,9 +1,15 @@
-{ pkgs, config, ... }:
+{
+  pkgs,
+  jolheiser,
+  config,
+  ...
+}:
 let
   port = 3663;
+  host = "recipes.${jolheiser.domain}";
 in
 {
-  age.secrets.mealie.file = ../secrets/mealie.age;
+  age.secrets.mealie.file = ../../secrets/mealie.age;
   services = {
     mealie = {
       enable = true;
@@ -18,12 +24,12 @@       );
       listenAddress = "localhost";
       inherit port;
       settings = {
-        BASE_URL = "https://recipes.jolheiser.com";
+        BASE_URL = "https://${host}";
         ALLOW_PASSWORD_LOGIN = "false";
       };
       credentialsFile = config.age.secrets.mealie.path;
     };
-    caddy.virtualHosts."recipes.jolheiser.com".extraConfig = ''
+    caddy.virtualHosts."${host}".extraConfig = ''
       reverse_proxy localhost:${builtins.toString port}
     '';
   };
M dragonwell/miniserve.nix -> dragonwell/services/miniserve.nix
1
2
3
diff --git a/dragonwell/miniserve.nix b/dragonwell/services/miniserve.nix
rename from dragonwell/miniserve.nix
rename to dragonwell/services/miniserve.nix
M dragonwell/mint.nix -> dragonwell/services/mint.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/dragonwell/mint.nix b/dragonwell/services/mint.nix
rename from dragonwell/mint.nix
rename to dragonwell/services/mint.nix
index 679b5ce611e9d53a9d12a2a0084e886557add363..71db8d12a12fbe19ee6a48f099686e04d71c93ae 100644
--- a/dragonwell/mint.nix
+++ b/dragonwell/services/mint.nix
@@ -1,5 +1,6 @@
 {
   inputs,
+  jolheiser,
   pkgs,
   config,
   ...
@@ -8,7 +9,7 @@ let
   port = 6468;
 in
 {
-  age.secrets.mint.file = ../secrets/mint.age;
+  age.secrets.mint.file = ../../secrets/mint.age;
   services = {
     mint = {
       enable = true;
@@ -18,7 +19,7 @@         MINT_LOG_LEVEL = "INFO";
       };
       environmentFile = config.age.secrets.mint.path;
     };
-    caddy.virtualHosts."budget.jolheiser.com".extraConfig = ''
+    caddy.virtualHosts."budget.${jolheiser.domain}".extraConfig = ''
       handle_path /static/* {
         root * ${inputs.mint.packages.${pkgs.stdenv.hostPlatform.system}.default}/lib/mint/static/
         file_server
D dragonwell/oa2p.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff --git a/dragonwell/oa2p.nix b/dragonwell/oa2p.nix
deleted file mode 100644
index c3ca8fc5a7c321e6a0f14889df6c976304abf45a..0000000000000000000000000000000000000000
--- a/dragonwell/oa2p.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{ config, ... }:
-let
-  port = 6227;
-in
-{
-  age.secrets.oa2p.file = ../secrets/oa2p.age;
-  services = {
-    oauth2-proxy = {
-      enable = true;
-      provider = "oidc";
-      httpAddress = "localhost:${builtins.toString port}";
-      reverseProxy = true;
-      cookie = {
-        secure = true;
-        domain = "wiki.jolheiser.com";
-      };
-      email.domains = [ "*" ];
-      keyFile = config.age.secrets.oa2p.path;
-      redirectURL = "https://wiki.jolheiser.com/oauth2/callback";
-      oidcIssuerUrl = "https://id.jolheiser.com";
-    };
-    caddy.virtualHosts."oa2p.jolheiser.com".extraConfig = ''
-      reverse_proxy localhost:${builtins.toString port}
-    '';
-  };
-}
M dragonwell/pocket-id.nix -> dragonwell/services/pocket-id.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff --git a/dragonwell/pocket-id.nix b/dragonwell/services/pocket-id.nix
rename from dragonwell/pocket-id.nix
rename to dragonwell/services/pocket-id.nix
index 993f938f133e2f00a3d9620852ecd155e40c4bf3..04f90178059566e2b3edcff835716def6e6364b2 100644
--- a/dragonwell/pocket-id.nix
+++ b/dragonwell/services/pocket-id.nix
@@ -1,14 +1,15 @@
-{ config, ... }:
+{ config, jolheiser, ... }:
 let
   port = 2884;
+  host = "id.${jolheiser.domain}";
 in
 {
-  age.secrets.pocket-id.file = ../secrets/pocket-id.age;
+  age.secrets.pocket-id.file = ../../secrets/pocket-id.age;
   services = {
     pocket-id = {
       enable = true;
       settings = {
-        APP_URL = "https://id.jolheiser.com";
+        APP_URL = "https://${host}";
         PORT = port;
         APP_NAME = "jolheiser ID";
         EMAILS_VERIFIED = true;
@@ -18,7 +19,7 @@         ANALYTICS_DISABLED = true;
       };
       environmentFile = config.age.secrets.pocket-id.path;
     };
-    caddy.virtualHosts."id.jolheiser.com".extraConfig = ''
+    caddy.virtualHosts."${host}".extraConfig = ''
       reverse_proxy localhost:${builtins.toString port}
     '';
   };
M dragonwell/pubserve.nix -> dragonwell/services/pubserve.nix
1
2
3
diff --git a/dragonwell/pubserve.nix b/dragonwell/services/pubserve.nix
rename from dragonwell/pubserve.nix
rename to dragonwell/services/pubserve.nix
M dragonwell/restic.nix -> dragonwell/services/restic.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
diff --git a/dragonwell/restic.nix b/dragonwell/services/restic.nix
rename from dragonwell/restic.nix
rename to dragonwell/services/restic.nix
index f56bedca5a3d97c1ec635a0120d10bbdf9287608..fe861a1f577743645d830ea80077317099e3b5e3 100644
--- a/dragonwell/restic.nix
+++ b/dragonwell/services/restic.nix
@@ -1,9 +1,9 @@
 { config, ... }:
 {
   age.secrets = {
-    restic-env.file = ../secrets/restic-env.age;
-    restic-pass.file = ../secrets/restic-pass.age;
-    restic-repo.file = ../secrets/restic-repo.age;
+    restic-env.file = ../../secrets/restic-env.age;
+    restic-pass.file = ../../secrets/restic-pass.age;
+    restic-repo.file = ../../secrets/restic-repo.age;
   };
   services.restic.backups.dragonwell = {
     initialize = true;
I dragonwell/services/go.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
diff --git a/dragonwell/services/go.nix b/dragonwell/services/go.nix
new file mode 100644
index 0000000000000000000000000000000000000000..18fcc61e67a6fade1c3f58cf777b38b762f24bb7
--- /dev/null
+++ b/dragonwell/services/go.nix
@@ -0,0 +1,38 @@
+{ jolheiser, ... }:
+let
+  altModules = [
+    {
+      name = "hcaptcha";
+      repo = "gitea.com/jolheiser/hcaptcha";
+    }
+    {
+      name = "pwn";
+      repo = "gitea.com/jolheiser/pwn";
+    }
+  ];
+  host = "go.${jolheiser.domain}";
+  redirects = builtins.concatStringsSep "\n" (
+    builtins.map (module: ''
+      respond /${module.name}* `<html><head>
+                <meta name="go-import" content="${host}/${module.name} git https://${module.repo}.git">
+                <meta http-equiv="refresh" content="3; url=https://pkg.go.dev/${host}/${module.name}" />
+                </head><body>
+                Redirecting to <a href="https://pkg.go.dev/${host}/${module.name}">https://pkg.go.dev/${host}/${module.name}</a>
+                </body></html>`
+    '') altModules
+  );
+in
+{
+  services.caddy.virtualHosts."${host}" = {
+    extraConfig = ''
+      header Content-Type text/html
+      ${redirects}
+      respond /* `<html><head>
+        <meta name="go-import" content="${host}{path} git https://git.jolheiser.com{path}.git">
+        <meta http-equiv="refresh" content="3; url=https://pkg.go.dev/${host}{path}" />
+        </head><body>
+        Redirecting to <a href="https://pkg.go.dev/${host}{path}">https://pkg.go.dev/${host}{path}</a>
+        </body></html>`
+    '';
+  };
+}
I dragonwell/services/oa2p.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff --git a/dragonwell/services/oa2p.nix b/dragonwell/services/oa2p.nix
new file mode 100644
index 0000000000000000000000000000000000000000..bf84920a0853b843cbf0d91714fd4db6d8ae2eeb
--- /dev/null
+++ b/dragonwell/services/oa2p.nix
@@ -0,0 +1,26 @@
+{ jolheiser, config, ... }:
+let
+  port = 6227;
+in
+{
+  age.secrets.oa2p.file = ../../secrets/oa2p.age;
+  services = {
+    oauth2-proxy = {
+      enable = true;
+      provider = "oidc";
+      httpAddress = "localhost:${builtins.toString port}";
+      reverseProxy = true;
+      cookie = {
+        secure = true;
+        domain = "wiki.${jolheiser.domain}";
+      };
+      email.domains = [ "*" ];
+      keyFile = config.age.secrets.oa2p.path;
+      redirectURL = "https://wiki.${jolheiser.domain}/oauth2/callback";
+      oidcIssuerUrl = "https://id.${jolheiser.domain}";
+    };
+    caddy.virtualHosts."oa2p.${jolheiser.domain}".extraConfig = ''
+      reverse_proxy localhost:${builtins.toString port}
+    '';
+  };
+}
M dragonwell/soju.nix -> dragonwell/services/soju.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff --git a/dragonwell/soju.nix b/dragonwell/services/soju.nix
rename from dragonwell/soju.nix
rename to dragonwell/services/soju.nix
index 01f4534190c57cc26a4822da1f6fc62ce862ebd1..e2cdc04473fe08dd41dc285e3e3c2c14f43dcf38 100644
--- a/dragonwell/soju.nix
+++ b/dragonwell/services/soju.nix
@@ -1,13 +1,14 @@
-{ lib, ... }:
+{ jolheiser, lib, ... }:
 let
-  baseCertPath = "/var/lib/acme/irc.jolheiser.com";
+  baseCertPath = "/var/lib/acme/${host}";
   port = 7658;
+  host = "irc.${jolheiser.domain}";
 in
 {
   security.acme = {
     acceptTerms = true;
     email = "irc@jolheiser.com";
-    certs."irc.jolheiser.com" = {
+    certs."${host}" = {
       listenHTTP = ":${builtins.toString port}";
       postRun = "systemctl reload soju";
       group = "soju";
@@ -19,7 +20,7 @@       enable = true;
       tlsCertificate = "${baseCertPath}/fullchain.pem";
       tlsCertificateKey = "${baseCertPath}/key.pem";
     };
-    caddy.virtualHosts."irc.jolheiser.com".extraConfig = ''
+    caddy.virtualHosts."${host}".extraConfig = ''
       reverse_proxy localhost:${builtins.toString port}
     '';
   };
M dragonwell/ugit.nix -> dragonwell/services/ugit.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
diff --git a/dragonwell/ugit.nix b/dragonwell/services/ugit.nix
rename from dragonwell/ugit.nix
rename to dragonwell/services/ugit.nix
index c985c6e38fe0d2e9ef06a78e13d7fd144cea74d4..baa2ffdda1b39b446e54193c640f95d6ff6dfb30 100644
--- a/dragonwell/ugit.nix
+++ b/dragonwell/services/ugit.nix
@@ -1,7 +1,8 @@
-{ lib, ... }:
+{ jolheiser, lib, ... }:
 let
   pubPort = 8449;
   privPort = 8447;
+  host = "git.${jolheiser.domain}";
   opts =
     let
       homeDir = "/var/lib/ugit";
@@ -17,15 +18,15 @@       hostKeyFile = "${homeDir}/ugit_ed25519";
       user = "ugit";
       group = "ugit";
       config = {
-        ssh.clone-url = "ugit@git.jolheiser.com";
+        ssh.clone-url = "ugit@${host}";
         http = {
           port = pubPort;
-          clone-url = "https://git.jolheiser.com";
+          clone-url = "https://${host}";
         };
         log.json = true;
         profile = {
-          username = "jolheiser";
-          email = "ugit@jolheiser.com";
+          username = jolheiser.username;
+          email = "ugit@${jolheiser.domain}";
           links = [
             "Github,https://github.com/jolheiser"
             "Gitea,https://gitea.com/jolheiser"
@@ -53,7 +54,7 @@       hostname = "git";
       port = privPort;
       authKey = "tskey-auth-kyuvaLt8pb11CNTRL-admMYrs6UWb5XaCcdWJAWbriZ6JMo7ksK"; # One-time key
     };
-    caddy.virtualHosts."git.jolheiser.com".extraConfig = ''
+    caddy.virtualHosts."${host}".extraConfig = ''
       reverse_proxy localhost:${builtins.toString pubPort}
     '';
   };
M dragonwell/woodpecker.nix -> dragonwell/services/woodpecker.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff --git a/dragonwell/woodpecker.nix b/dragonwell/services/woodpecker.nix
rename from dragonwell/woodpecker.nix
rename to dragonwell/services/woodpecker.nix
index 492498d7f1c0525eef4903c1c8eb1dc1b00238fb..ab586889423b3467c1f1fd4f8812c31202fbce30 100644
--- a/dragonwell/woodpecker.nix
+++ b/dragonwell/services/woodpecker.nix
@@ -1,5 +1,6 @@
 {
   inputs,
+  jolheiser,
   pkgs,
   config,
   ...
@@ -8,7 +9,7 @@ let
   port = 2423;
 in
 {
-  age.secrets.woodpecker.file = ../secrets/woodpecker.age;
+  age.secrets.woodpecker.file = ../../secrets/woodpecker.age;
   services = {
     woodpecker-server = {
       enable = true;
@@ -22,8 +23,8 @@         WOODPECKER_ADMIN = "jolheiser";
         WOODPECKER_SERVER_ADDR = ":${builtins.toString port}";
 
         GITPECKER_REPOS = "/var/lib/ugit/repos";
-        GITPECKER_URL = "https://git.jolheiser.com";
-        GITPECKER_PROVIDER = "https://id.jolheiser.com";
+        GITPECKER_URL = "https://git.${jolheiser.domain}";
+        GITPECKER_PROVIDER = "https://id.${jolheiser.domain}";
         GITPECKER_CLIENT_ID = "6975ecea-ce29-48f0-ad8d-323e419f7732";
         GITPECKER_REDIRECT = "https://cicd/authorize";
         GITPECKER_LOG_FILE = "/var/lib/woodpecker-server/gitpecker.log";
M dragonwell/zoekt.nix -> dragonwell/services/zoekt.nix
1
2
3
diff --git a/dragonwell/zoekt.nix b/dragonwell/services/zoekt.nix
rename from dragonwell/zoekt.nix
rename to dragonwell/services/zoekt.nix
M flake.nix -> flake.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/flake.nix b/flake.nix
index 73e690b4f8ca32ea4ba1abed71c5b94da029ea52..4a508f62b21bb5eabfc921723a98fa7079080d33 100644
--- a/flake.nix
+++ b/flake.nix
@@ -42,13 +42,14 @@     }@inputs:
     let
       system = "x86_64-linux";
       pkgs = import inputs.nixpkgs { inherit system; };
+      jolheiser = import ./config.nix { inherit pkgs; };
     in
     {
       colmena = {
         meta = {
           nixpkgs = import nixpkgs { inherit system; };
           specialArgs = {
-            inherit inputs;
+            inherit jolheiser inputs;
           };
         };
         dragonwell.imports = [