mkModule various
This commit is contained in:
@@ -6,26 +6,32 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.${namespace}.services.mongodb;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
name = "mongodb";
|
||||
cfg = config.${namespace}.services.${name};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
autoStart = cfg.autoStart;
|
||||
image = cfg.image;
|
||||
ports = [ "${cfg.port}:27017" ];
|
||||
volumes = [ "${cfg.configPath}:/data/db" ];
|
||||
extraOptions = [ "--network-alias=mongo" ];
|
||||
# environmentFiles = cfg.environmentFiles;
|
||||
environment = {
|
||||
PUID = cfg.puid;
|
||||
PGID = cfg.pgid;
|
||||
TZ = cfg.timeZone;
|
||||
# MONGO_INITDB_ROOT_USERNAME = "";#cfg.databaseUser;
|
||||
# MONGO_INITDB_ROOT_PASSWORD = "";#cfg.databasePassword; # get from env file
|
||||
mongodbConfig = lib.${namespace}.mkModule {
|
||||
inherit config name;
|
||||
description = "mongodb";
|
||||
options = { };
|
||||
moduleConfig = {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
autoStart = true;
|
||||
image = "mongo";
|
||||
ports = [ "${cfg.port}:27017" ];
|
||||
volumes = [ "${cfg.configPath}/mongodb:/data/db" ];
|
||||
extraOptions = [ "--network-alias=mongo" ];
|
||||
# environmentFiles = cfg.environmentFiles;
|
||||
environment = {
|
||||
PUID = cfg.puid;
|
||||
PGID = cfg.pgid;
|
||||
TZ = cfg.timeZone;
|
||||
# MONGO_INITDB_ROOT_USERNAME = "";#cfg.databaseUser;
|
||||
# MONGO_INITDB_ROOT_PASSWORD = "";#cfg.databasePassword; # get from env file
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ mongodbConfig ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user