commit e6c4bbbfcaa8a038fbdc45ca2e7672d80b1a4386
parent 1fe1ed45e7d5a2d31ae07bcd3a5522e8aa3e6c2a
Author: Silas Brack <silasbrack@gmail.com>
Date: Sun, 7 Jun 2026 21:45:32 +0200
feat: use WASM guest for FTS5 search, remove rusqlite
Load search_guest.wasm into trailbase, remove DB_PATH and
BindReadOnlyPaths. Add CacheDirectory for wasmtime cache.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/flake.lock b/flake.lock
@@ -318,11 +318,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
- "lastModified": 1780860558,
- "narHash": "sha256-A+8L9WSsp+ARpbLkisAxxk95eU9vH5T5NJW8okOc8/I=",
+ "lastModified": 1780861355,
+ "narHash": "sha256-c1i1dTrKB3qWibPqTGrJhL3SjMPOilP16UVZV23MuOM=",
"ref": "refs/heads/main",
- "rev": "e42a8b9e1c04ccbd1f3f983457156326e1fb2d73",
- "revCount": 86,
+ "rev": "7dab23b73245ecfc4adc4280e64c0c02ca44cbc7",
+ "revCount": 88,
"type": "git",
"url": "ssh://forgejo@git.fnarglebeast.com/silas/simple-web-app.git"
},
diff --git a/modules/simple-web-app.nix b/modules/simple-web-app.nix
@@ -60,12 +60,16 @@ in
DynamicUser = true;
StateDirectory = "simple-web-app-trailbase";
StateDirectoryMode = "0755";
+ CacheDirectory = "simple-web-app-trailbase";
+ Environment = "HOME=/var/lib/simple-web-app-trailbase";
# Run setup as root before dropping to DynamicUser (+ prefix = run as root)
ExecStartPre = let
setupScript = pkgs.writeShellScript "simple-web-app-trailbase-setup" ''
mkdir -p /var/lib/simple-web-app-trailbase/traildepot/migrations
+ mkdir -p /var/lib/simple-web-app-trailbase/traildepot/wasm
cp ${cfg.traildepotPath}/config.textproto /var/lib/simple-web-app-trailbase/traildepot/
cp -r ${cfg.traildepotPath}/migrations/* /var/lib/simple-web-app-trailbase/traildepot/migrations/
+ cp -r ${cfg.traildepotPath}/wasm/* /var/lib/simple-web-app-trailbase/traildepot/wasm/ 2>/dev/null || true
# Configure SMTP for email verification via local mailserver
${pkgs.gnused}/bin/sed -i 's|email {}|email {\n smtp_host: "localhost"\n smtp_port: 25\n smtp_encryption: SMTP_ENCRYPTION_NONE\n sender_name: "SimpleWebApp"\n sender_address: "noreply@silasbrack.com"\n}|' /var/lib/simple-web-app-trailbase/traildepot/config.textproto
@@ -87,13 +91,11 @@ in
ExecStart = "${cfg.package}/bin/simple-web-app";
DynamicUser = true;
StateDirectory = "simple-web-app";
- BindReadOnlyPaths = [ "/var/lib/simple-web-app-trailbase/traildepot/data" ];
};
environment = {
PORT = builtins.toString cfg.port;
DEBUG = "false";
TRAILBASE_URL = "http://127.0.0.1:${builtins.toString cfg.trailbasePort}";
- DB_PATH = "/var/lib/simple-web-app-trailbase/traildepot/data/main.db";
RUST_LOG = "info";
};
};