Files
nix-config/modules/nixos/apps/mongodb/default.nix
2025-07-16 19:57:33 -05:00

27 lines
712 B
Nix
Executable File

{ lib, config, ... }:
with lib;
let
cfg = config.nas-apps.mongodb;
in
{
imports = [ ./options.nix ];
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
};
};
};
}