Files
Nomarchy/bin/nomarchy-install-docker-dbs
Bernardo Magri 29cc0d2547 feat: implement modular foundation and core system services
- Update flake.nix with 25.11 release and core inputs
- Add dedicated modules for audio (Pipewire), bluetooth, and networking
- Update GEMINI.md with the new Modular Merging Architecture blueprint
- Configure graphical installer ISO and test VM outputs
2026-04-03 21:06:42 +01:00

46 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Configure Docker declaratively and provide instructions for running DBs.
# Usually called via Install > Development > Docker DB from the Nomarchy Menu.
FEATURE_FILE="/etc/nixos/nomarchy-features/docker.nix"
if [ ! -f "$FEATURE_FILE" ]; then
sudo mkdir -p "/etc/nixos/nomarchy-features"
cat <<EOF | sudo tee "$FEATURE_FILE" > /dev/null
{ config, pkgs, ... }:
{
virtualisation.docker.enable = true;
users.users.\${config.users.users.mainUser}.extraGroups = [ "docker" ]; # Replace mainUser with your username
}
EOF
echo "Created $FEATURE_FILE to enable Docker."
echo "IMPORTANT: To finish enabling Docker, add './nomarchy-features/docker.nix' to your imports list in /etc/nixos/system.nix or /etc/nixos/flake.nix,"
echo "then run 'sys-update'."
echo "Wait for the update to complete before running docker commands."
echo ""
fi
options=("MySQL" "PostgreSQL" "Redis" "MongoDB" "MariaDB" "MSSQL")
if (( $# == 0 )); then
choices=$(printf "%s\n" "${options[@]}" | gum choose --header "Select database (ensure Docker is running)") || exit 0
else
choices="$@"
fi
if [[ -n $choices ]]; then
for db in $choices; do
case $db in
MySQL) sudo docker run -d --restart unless-stopped -p "127.0.0.1:3306:3306" --name=mysql8 -e MYSQL_ROOT_PASSWORD= -e MYSQL_ALLOW_EMPTY_PASSWORD=true mysql:8.4 ;;
PostgreSQL) sudo docker run -d --restart unless-stopped -p "127.0.0.1:5432:5432" --name=postgres18 -e POSTGRES_HOST_AUTH_METHOD=trust postgres:18 ;;
MariaDB) sudo docker run -d --restart unless-stopped -p "127.0.0.1:3306:3306" --name=mariadb11 -e MARIADB_ROOT_PASSWORD= -e MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=true mariadb:11.8 ;;
Redis) sudo docker run -d --restart unless-stopped -p "127.0.0.1:6379:6379" --name=redis redis:7 ;;
MongoDB) sudo docker run -d --restart unless-stopped -p "127.0.0.1:27017:27017" --name mongodb -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=admin123 mongo:noble ;;
MSSQL) sudo docker run -d --restart unless-stopped -p "127.0.0.1:1433:1433" --name mssql -e MSSQL_PID=Developer -e ACCEPT_EULA=Y -e "MSSQL_SA_PASSWORD=@dmin123" mcr.microsoft.com/mssql/server:2022-CU12-ubuntu-22.04 ;;
esac
done
else
echo "No databases selected for installation."
fi