diff --git a/seafile-test.nix b/seafile-test.nix index 3dd349b..62aeded 100644 --- a/seafile-test.nix +++ b/seafile-test.nix @@ -28,8 +28,30 @@ domainName = "seaf.local"; db = { type = "mysql"; - passwordFile = toString (pkgs.writeText "testPW" "lol"); + passwordFile = toString (pkgs.writeText "testPW" "test"); }; }; + # db backend + services.mysql = + { + enable = true; + package = pkgs.mariadb; + ensureDatabases = [ "ccnet" "seafile" "seahub" ]; + ensureUsers = [ + rec { + name = config.services.seafile-server.db.user; + ensurePermissions = { + "ccnet.*" = "ALL PRIVILEGES"; + "seafile.*" = "ALL PRIVILEGES"; + "seahub.*" = "ALL PRIVILEGES"; + }; + } + ]; + # set a password for the seafile user + initialScript = pkgs.writeText "mariadb-init.sql" '' + CREATE USER ${config.services.seafile-server.db.user}@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD("test"); + ''; + }; + }