From 5fba2ce2a9782c8acc896d31b8ab974504db30fa Mon Sep 17 00:00:00 2001 From: Savyasachee Jha Date: Fri, 4 Jul 2025 08:24:46 +0200 Subject: [PATCH] nixosTests.bookstack: Updated to also test passwordless login for mysql --- nixos/tests/bookstack.nix | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/nixos/tests/bookstack.nix b/nixos/tests/bookstack.nix index a0c9b39c1c0e..59924e0395ee 100644 --- a/nixos/tests/bookstack.nix +++ b/nixos/tests/bookstack.nix @@ -1,12 +1,14 @@ { pkgs, ... }: let - db-pass = "Test2Test2"; app-key = "TestTestTestTestTestTestTestTest"; in { name = "bookstack"; - meta.maintainers = [ pkgs.lib.maintainers.savyajha ]; + meta = { + maintainers = [ pkgs.lib.maintainers.savyajha ]; + platforms = pkgs.lib.platforms.linux; + }; nodes.bookstackMysql = { services.bookstack = { @@ -19,7 +21,6 @@ in SITE_OWNER = "mail@example.com"; DB_DATABASE = "bookstack"; DB_USERNAME = "bookstack"; - DB_PASSWORD_FILE = pkgs.writeText "mysql-pass" db-pass; DB_SOCKET = "/run/mysqld/mysqld.sock"; }; }; @@ -27,12 +28,18 @@ in services.mysql = { enable = true; package = pkgs.mariadb; - initialScript = pkgs.writeText "bookstack-init.sql" '' - create database bookstack DEFAULT CHARACTER SET utf8mb4; - create user 'bookstack'@'localhost' identified by '${db-pass}'; - grant all on bookstack.* to 'bookstack'@'localhost'; - ''; settings.mysqld.character-set-server = "utf8mb4"; + ensureDatabases = [ + "bookstack" + ]; + ensureUsers = [ + { + name = "bookstack"; + ensurePermissions = { + "bookstack.*" = "ALL PRIVILEGES"; + }; + } + ]; }; };