1{ pkgs, ... }:
2
3let
4 app-key = "TestTestTestTestTestTestTestTest";
5in
6{
7 name = "bookstack";
8 meta = {
9 maintainers = [ pkgs.lib.maintainers.savyajha ];
10 platforms = pkgs.lib.platforms.linux;
11 };
12
13 nodes.bookstackMysql = {
14 services.bookstack = {
15 enable = true;
16 hostname = "localhost";
17 nginx.onlySSL = false;
18 settings = {
19 APP_KEY_FILE = pkgs.writeText "bookstack-appkey" app-key;
20 LOG_CHANNEL = "stdout";
21 SITE_OWNER = "mail@example.com";
22 DB_DATABASE = "bookstack";
23 DB_USERNAME = "bookstack";
24 DB_SOCKET = "/run/mysqld/mysqld.sock";
25 };
26 };
27
28 services.mysql = {
29 enable = true;
30 package = pkgs.mariadb;
31 settings.mysqld.character-set-server = "utf8mb4";
32 ensureDatabases = [
33 "bookstack"
34 ];
35 ensureUsers = [
36 {
37 name = "bookstack";
38 ensurePermissions = {
39 "bookstack.*" = "ALL PRIVILEGES";
40 };
41 }
42 ];
43 };
44 };
45
46 testScript = ''
47 bookstackMysql.wait_for_unit("phpfpm-bookstack.service")
48 bookstackMysql.wait_for_unit("nginx.service")
49 bookstackMysql.wait_for_unit("mysql.service")
50 bookstackMysql.succeed("curl -fvvv -Ls http://localhost/ | grep 'Log In'")
51 '';
52}