nixos/services/mariaDB.nix

28 lines
871 B
Nix
Raw Normal View History

2019-02-26 13:44:40 +01:00
{ config, pkgs, ... }:
let
nextcloudpwd = (builtins.replaceStrings ["\n"] [""] (builtins.readFile /secret/nextcloud_db));
giteapwd = (builtins.replaceStrings ["\n"] [""] (builtins.readFile /secret/gitea));
in {
services.mysql = {
enable = true;
package = pkgs.mariadb;
initialDatabases = [ {
name = "nextcloud";
schema = pkgs.writeText "nextcloud.sql"
''
create user if not exists 'nextcloud'@'localhost' identified by ${nextcloudpwd};
grant all privileges on nextcloud.* to 'nextcloud'@'localhost' identified by ${nextcloudpwd};
'';
}
{
name = "gitea";
schema = pkgs.writeText "gitea.sql"
''
create user if not exists 'git'@'localhost' identified by ${giteapwd};
grant all privileges on gitea.* to 'git'@'localhost' identified by ${giteapwd};
'';
} ];
};
}