From 2e3040e4bb8d768b19a271533557c2ce54757693 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Mon, 12 Oct 2026 16:28:37 +0200 Subject: [PATCH] manatee: Add `dagbok` Served at dagbok.ppp.pm through nginx from 127.0.0.1:8093, with its token from agenix, a Hetzner DNS-01 certificate, a dynamic DNS record and a state backup snapshot. --- flake.nix | 6 ++ hosts/manatee/modules/certs/default.nix | 1 + hosts/manatee/modules/dagbok/default.nix | 59 +++++++++++++++++++ hosts/manatee/modules/default.nix | 1 + .../modules/home-assistant/default.nix | 2 +- hosts/manatee/modules/restic/default.nix | 1 + secrets/manatee/dagbok-token.age | 9 +++ secrets/secrets.nix | 1 + 8 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 hosts/manatee/modules/dagbok/default.nix create mode 100644 secrets/manatee/dagbok-token.age diff --git a/flake.nix b/flake.nix index 5118581..dbc847f 100644 --- a/flake.nix +++ b/flake.nix @@ -110,6 +110,12 @@ # url = "git+file:///home/alex/code/todo?ref=main"; inputs.nixpkgs.follows = "nixpkgs"; }; + + dagbok = { + url = "git+ssh://gitea@git.ppp.pm:1122/alex/dagbok.git?ref=main"; + # url = "git+file:///home/alex/code/own/dagbok?ref=main"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = diff --git a/hosts/manatee/modules/certs/default.nix b/hosts/manatee/modules/certs/default.nix index 778d7f4..61f5507 100644 --- a/hosts/manatee/modules/certs/default.nix +++ b/hosts/manatee/modules/certs/default.nix @@ -31,6 +31,7 @@ in "puppy.ppp.pm" "todo.ppp.pm" "schema.ppp.pm" + "dagbok.ppp.pm" ] (_: hetznerCert); }; diff --git a/hosts/manatee/modules/dagbok/default.nix b/hosts/manatee/modules/dagbok/default.nix new file mode 100644 index 0000000..4a79deb --- /dev/null +++ b/hosts/manatee/modules/dagbok/default.nix @@ -0,0 +1,59 @@ +{ + inputs, + lib, + config, + ... +}: +let + enabled = config.mod.dagbok.enable; + nginxEnabled = config.mod.nginx.enable; + port = 8093; +in +{ + options = { + mod.dagbok = { + enable = lib.mkEnableOption "Enable dagbok module"; + }; + }; + + imports = [ + inputs.dagbok.nixosModules.default + ]; + + config = lib.mkIf enabled { + mod.homepage.services = [ + { + name = "Dagbok"; + port = port; + description = "Work and personal journal"; + url = "https://dagbok.ppp.pm"; + } + ]; + + services.dagbok = { + enable = true; + address = "127.0.0.1"; + inherit port; + secureCookies = true; + timeZone = "Europe/Stockholm"; + publicUrl = "https://dagbok.ppp.pm"; + tokenFile = config.age.secrets."dagbok-token".path; + }; + + services.nginx = lib.mkIf nginxEnabled { + virtualHosts."dagbok.ppp.pm" = { + forceSSL = true; + useACMEHost = "dagbok.ppp.pm"; + extraConfig = '' + client_max_body_size 32m; + ''; + + locations."/" = { + proxyPass = "http://127.0.0.1:${toString port}"; + }; + }; + }; + + age.secrets."dagbok-token".file = ../../../../secrets/manatee/dagbok-token.age; + }; +} diff --git a/hosts/manatee/modules/default.nix b/hosts/manatee/modules/default.nix index ea7adac..dc527ca 100644 --- a/hosts/manatee/modules/default.nix +++ b/hosts/manatee/modules/default.nix @@ -31,6 +31,7 @@ in todo.enable = true; schema.enable = true; atuin.enable = true; + dagbok.enable = true; }; }; } diff --git a/hosts/manatee/modules/home-assistant/default.nix b/hosts/manatee/modules/home-assistant/default.nix index c9d68a2..06705d2 100644 --- a/hosts/manatee/modules/home-assistant/default.nix +++ b/hosts/manatee/modules/home-assistant/default.nix @@ -251,7 +251,7 @@ in ]; script = '' - SUBDOMAINS="ha komga romm puppy todo schema" + SUBDOMAINS="ha komga romm puppy todo schema dagbok" INTERFACE="enp3s0" CURRENT_IP=$(curl -s --fail --interface "$INTERFACE" ifconfig.me) diff --git a/hosts/manatee/modules/restic/default.nix b/hosts/manatee/modules/restic/default.nix index f3a2cf9..1d55fa0 100644 --- a/hosts/manatee/modules/restic/default.nix +++ b/hosts/manatee/modules/restic/default.nix @@ -108,6 +108,7 @@ let snapshot /var/lib/solo-referee "$STATE/solo-referee" snapshot /var/lib/todo "$STATE/todo" snapshot /var/lib/schema "$STATE/schema" + snapshot /var/lib/dagbok "$STATE/dagbok" snapshot /var/lib/komga-book-manager "$STATE/komga-book-manager" snapshot /var/lib/komga-reading-stats "$STATE/komga-reading-stats" diff --git a/secrets/manatee/dagbok-token.age b/secrets/manatee/dagbok-token.age new file mode 100644 index 0000000..b24ae2c --- /dev/null +++ b/secrets/manatee/dagbok-token.age @@ -0,0 +1,9 @@ +age-encryption.org/v1 +-> ssh-ed25519 wkRvNA HUrz7xanuOlXVzDIUTX9ekLPWJUu2FzVf3ZY/XbtqSA +7qKwaUNsHRtz7uNmk2FeBealiW8S3bAWcKJCFwhDhQ4 +-> ssh-ed25519 vxPbZg HimT6C2qLyhitFXIad6wFBuwEljg8ER1TtE9FRvFHmM +9NcXChDz8Hma33umDRZkg8kWsG+8LDZKhT1/TSGcbMQ +-> ssh-ed25519 +oNaHQ ZrUo9uKv/edXs4tYAsgM5BgAbFAyPBlYkQ/yoMpj2Q8 +71Q0DtYxwzzHjlbixWsJN4kzq432cS1cvltC/sTe4C8 +--- +w7cxzo0KoG4wzfzrEcG0GB7XuBUlhyyunyObRn4TyQ +±ª'z¬¸»—}Ä�.ïVo¼wŽ�õ¼eJZ /žÈßXµ•0-R([Û9d'ô6ŠÒÏ•b�Z–öÊ.[�§~ÀtpÈvß)ÐÁ,=[: \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index d233c99..23c8cb0 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -46,6 +46,7 @@ in { "manatee/puppy-tracker-invite-code.age".publicKeys = [ manatee alex ]; "manatee/solo-referee-api-key.age".publicKeys = [ manatee alex ]; "manatee/todo-token.age".publicKeys = [ manatee alex ]; + "manatee/dagbok-token.age".publicKeys = [ manatee pinwheel alex ]; "manatee/schema-invite-code.age".publicKeys = [ manatee alex ]; "manatee/restic-password.age".publicKeys = [ manatee alex ]; "manatee/restic-cloud-sync-key.age".publicKeys = [ manatee alex ];