Files
nixos/roles/dbserver-mariadb.nix

42 lines
966 B
Nix

# Module: roles/dbserver-mariadb
# Enables a database server running MariaDB
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.dbserver-mariadb;
defaultDBPackage = mariadb;
defaultPyMySQLPackage = python313Packages.pymysql;
in {
options.dbserver-mariadb = {
enable = mkEnableOption "Enables dbserver-mariadb role";
dbPackage = mkOption {
type = types.package;
default = defaultDBPackage;
description = "Package to use for the database server";
example = mariadb;
};
ansibleLibPackage = mkOption {
type = types.package;
default = defaultPyMySQLPackage;
description = "Python library to use for Ansible interfacing";
example = python313Packages.pymysql;
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
cfg.dbPackage
cfg.ansibleLibPackage
];
services.mysql = {
enable = true;
package = cfg.dbPackage;
};
};
}