Bladeren bron

feat(odin+many): a lot of additional services

Zander Hawke 9 maanden geleden
bovenliggende
commit
a366ba044a

+ 4 - 4
flake.lock

@@ -517,11 +517,11 @@
     },
     "secrets": {
       "locked": {
-        "lastModified": 1756834435,
-        "narHash": "sha256-oyuIk5XxOQbWuDzunmgX38JeuPsKJj7dHu8t2Hpy5Y8=",
+        "lastModified": 1756895361,
+        "narHash": "sha256-AXfHHVQMI+407fm/Ec+QohhITRsD/YpgnXVY6yCDWDM=",
         "ref": "refs/heads/master",
-        "rev": "0e5cfca3392609e1c80a25c7a2d7e03538da3fd9",
-        "revCount": 10,
+        "rev": "bd7584b71fc4ed9170df404cd1021235d6f1d470",
+        "revCount": 14,
         "type": "git",
         "url": "ssh://[email protected]/control/secrets.git"
       },

+ 4 - 0
hosts/odin/services/adguard.nix

@@ -6,6 +6,10 @@ in
   services.adguardhome = {
     enable = true;
     settings = {
+      host = "127.0.0.1";
+
+      users = [ ];
+
       dns.cache_enabled = true;
       dns.upstream_mode = "parallel";
       dns.upstream_dns = [

+ 4 - 4
hosts/odin/services/caddy.nix

@@ -13,9 +13,9 @@
       acme_dns cloudflare {env.CF_API_TOKEN}
     '';
 
-    virtualHosts.welcome.hostName = "{$DOMAIN}";
-    virtualHosts.welcome.extraConfig = ''
-      respond "Hello World"
-    '';
+    # virtualHosts.welcome.hostName = "{$DOMAIN}";
+    # virtualHosts.welcome.extraConfig = ''
+    #   respond "Hello World"
+    # '';
   };
 }

+ 2 - 0
hosts/odin/services/default.nix

@@ -3,9 +3,11 @@
     ./adguard.nix
     ./caddy.nix
     ./cloudflared.nix
+    ./homepage.nix
     ./immich.nix
     ./samba.nix
     ./snapraid.nix
     ./tailscale.nix
+    ./vaultwarden.nix
   ];
 }

+ 76 - 0
hosts/odin/services/homepage.nix

@@ -0,0 +1,76 @@
+{ config, ... }:
+let
+  cfg = config.services.homepage-dashboard;
+  domain = "odin.t5.st";
+in
+{
+  services.homepage-dashboard = {
+    enable = true;
+    allowedHosts = "${domain}";
+
+    bookmarks = [
+      {
+        Developer = [
+          {
+            Github = [
+              {
+                abbr = "GH";
+                href = "https://github.com/";
+              }
+            ];
+          }
+        ];
+      }
+      {
+        Entertainment = [
+          {
+            YouTube = [
+              {
+                abbr = "YT";
+                href = "https://youtube.com/";
+              }
+            ];
+          }
+        ];
+      }
+    ];
+
+    services = [
+      {
+        "Apps" = [
+          {
+            "AdGuard Home" = {
+              href = "https://adguard.odin.t5.st/";
+              description = "Network-wide ads & trackers blocking DNS server";
+            };
+          }
+          {
+            "Immich Photos" = {
+              href = "https://photos.t5.st/";
+              description = "High performance self-hosted photo and video management solution.";
+            };
+          }
+        ];
+      }
+    ];
+
+    widgets = [ ];
+
+    settings = {
+      title = "Odin (/ˈoʊdɪn/; from Old Norse: Óðinn)";
+      description = "A widely revered god in Norse mythology and Germanic paganism. Most surviving information on Odin comes from Norse mythology, but he figures prominently in the recorded history of Northern Europe.";
+      background = "https://images.unsplash.com/photo-1604223190546-a43e4c7f29d7?q=80&w=2669&auto=format&fit=crop&ixlib=rb-4.1.0";
+      cardBlur = "sm";
+      theme = "dark";
+      color = "stone";
+    };
+  };
+
+  services.caddy.virtualHosts.homepage = {
+    hostName = "{$DOMAIN}";
+    extraConfig = ''
+      encode gzip zstd
+      reverse_proxy 127.0.0.1:${toString cfg.listenPort}
+    '';
+  };
+}

+ 27 - 0
hosts/odin/services/vaultwarden.nix

@@ -0,0 +1,27 @@
+{ config, ... }:
+let
+  cfg = config.services.vaultwarden.config;
+in
+{
+  services.vaultwarden.enable = true;
+  services.vaultwarden.backupDir = "/mnt/storage/vaultwarden";
+  services.vaultwarden.config = {
+    ROCKET_ADDRESS = "127.0.0.1";
+    ROCKET_PORT = 8222;
+  };
+  services.vaultwarden.environmentFile =
+    config.age.secrets."odin/services/vaultwarden".path;
+
+  users.users.vaultwarden.extraGroups = [ "storage" ];
+  systemd.tmpfiles.rules = [
+    "d /mnt/storage/vaultwarden 0755 vaultwarden storage -"
+  ];
+
+  services.cloudflared.tunnels."71c89a7f-2467-444c-9fda-4864860dc8c4" = {
+    credentialsFile =
+      config.age.secrets."odin/services/cloudflared-tunnel".path;
+    default = "http_status:404";
+    ingress."vault.t5.st".service =
+      "http://${cfg.ROCKET_ADDRESS}:${toString cfg.ROCKET_PORT}";
+  };
+}

+ 2 - 0
hosts/odin/system/age.nix

@@ -21,6 +21,8 @@
       inputs.secrets."odin/services/samba.age";
     "odin/services/tailscale".file =
       inputs.secrets."odin/services/tailscale.age";
+    "odin/services/vaultwarden".file =
+      inputs.secrets."odin/services/vaultwarden.age";
     "odin/users/thomas".file =
       inputs.secrets."odin/users/thomas.age";
   };