about summary refs log tree commit diff
path: root/configuration.nix
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2023-07-09 01:39:58 +0300
committerVika <vika@fireburn.ru>2023-07-09 01:39:58 +0300
commita863a2b27902d2d8b87dae07c03f94e96d06d92b (patch)
tree960487de597f02f28b44d77966189d86d885e43c /configuration.nix
parent63148c502c11fcbe99f335c5d214fba84eda1c1c (diff)
Implement Postgres backend
A single giga-commit that took me weeks to produce. I know, this is
not exactly the best thing ever — but I wanted to experiment first
before "committing" to the implementation, so that I would produce the
best solution.
Diffstat (limited to 'configuration.nix')
-rw-r--r--configuration.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/configuration.nix b/configuration.nix
index b3b7ada..937b1c8 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -44,8 +44,9 @@ in {
         example = "redis://192.168.1.200:6379";
         description = lib.mdDoc ''
           Set the backend used for storing data. Available backends are:
-           - `file://` - static folder backend (recommended)
-           - `redis://` - Redis backend (currently unavailable)
+           - `postgres://` - PostgreSQL backend (recommended)
+           - `file://`     - static folder backend
+           - `redis://`    - Redis backend (currently unavailable)
 
           Make sure that if you are using the file backend, the state
           directory is accessible by Kittybox. By default, the unit config
@@ -114,6 +115,12 @@ in {
     };
   };
   config = lib.mkIf cfg.enable {
+    assertions = [
+      {
+        assertion = lib.strings.hasPrefix cfg.backendUri "postgres://" -> cfg.package.hasPostgres;
+        message = "To use the Postgres backend, Kittybox has to be compiled with Postgres support enabled.";
+      }
+    ];
     systemd.services.kittybox = {
       description = "An IndieWeb-enabled blog engine";