21 lines
595 B
Nix
21 lines
595 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
giteapwd = if config.services.gitea.enable then (builtins.readFile /secret/gitea) else "";
|
|
in mkIf (elem "mariaDB" config.machine.services) {
|
|
services.mysql = {
|
|
enable = true;
|
|
package = pkgs.mariadb;
|
|
initialDatabases = if config.services.gitea.enable then [ {
|
|
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};
|
|
'';
|
|
} ] else [];
|
|
};
|
|
}
|
|
|