For Linux users (including Arch Linux):
Bash/Zsh:
sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --daemonFish shell:
curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install | sh -s -- --daemonFor macOS users, see the official Nix installation guide.
If you get "File already exists" errors: You likely have Nix already installed. Instead of reinstalling, just activate it in your current shell:
# For fish shell users
set -U fish_user_paths /nix/var/nix/profiles/default/bin $fish_user_paths# For bash/zsh users
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.shThen verify with: nix --version
Flakes require experimental features to be enabled. Choose one option:
Option 1 - Enable permanently (recommended):
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.confOption 2 - Use flags each time:
nix --extra-experimental-features "nix-command flakes" flake update
nix --extra-experimental-features "nix-command flakes" developInstall PostgreSQL with your package manager of choice:
Arch Linux (paru/yay/pacman):
paru -S postgresql
# or: yay -S postgresql
# or: sudo pacman -S postgresqlUbuntu/Debian:
sudo apt update
sudo apt install postgresql postgresql-contribmacOS (Homebrew):
brew install postgresql@14Other Linux distros: Install postgres with your package manager of choice.
After installing PostgreSQL, you need to initialize and configure the database:
-
Initialize the database cluster:
# Arch Linux sudo -u postgres initdb -D /var/lib/postgres/data # Ubuntu/Debian (usually auto-initialized during install) # Skip this step if /var/lib/postgresql/14/main already exists
-
Start and enable PostgreSQL service:
sudo systemctl start postgresql sudo systemctl enable postgresql -
Create your database user:
sudo -u postgres createuser --interactive $(whoami) # When prompted, choose: # - Shall the new role be a superuser? (y/n) y
-
Create the teleband database:
sudo -u postgres createdb teleband -O $(whoami)
-
Start PostgreSQL service:
brew services start postgresql@14
-
Initialize database (if needed):
initdb --locale=C -E UTF-8 $(brew --prefix)/var/postgresql@14 -
Create the teleband database:
createdb teleband
Test your database connection:
psql -d teleband -c "SELECT version();"If successful, you should see PostgreSQL version information.
- Clone your MusicCPR backend repository
- Copy
flake.nixfrom this repo to yourMusic-CPR-Backend/clone's root directory - Track the flake file with git (this is necessary)
- Update and enter the nix development shell:
cd Music-CPR-Backend/
nix flake update && nix developOnce in the nix shell, you'll see the help menu with available commands:
🎵 MusicCPR Development Environment Help
=======================================
📚 Available Commands:
mhelp - Show this help message
musiccpr_init - First-time setup (venv, deps, database, superuser)
musiccpr_start - Daily startup (activate venv, check migrations)
musiccpr_status - Check environment status
🚀 Running Services:
backend - Start Django server
frontend - Start Next.js server (run in new terminal)
📍 Project URLs:
Django Admin: http://127.0.0.1:8000/admin/
Frontend: http://localhost:3000
⚠️ Prerequisites:
- PostgreSQL must be installed and running (see PostgreSQL setup above)
- Database 'teleband' must exist and be accessible by your user
📝 Quick Start:
1. Ensure PostgreSQL is running
2. Run 'musiccpr_init' (first time only)
3. Run 'backend' and 'frontend' in separate terminals