A Mix task that wraps any Elixir Mix project generator in a devenv.sh environment.
Installation
Install the archive directly from Hex:
mix archive.install hex devenv_new
Usage
Use mix devenv.new
to wrap any Mix project generator:
# Create a Phoenix project with devenv
mix devenv.new phx.new my_app --devenv postgres,redis
# Create an Igniter project with devenv
mix devenv.new igniter.new my_project --devenv elixir=1.17,postgres --install ash,ash_postgres
# Create a basic Elixir project with devenv
mix devenv.new new my_lib --devenv elixir=1.17,minio --sup
# To run Mix in a temporary Elixir Nix environment
nix-shell -p elixir --run 'mix devenv.new igniter.new demo_app '\
'--devenv postgres,bun '\
'--install ash,ash_postgres,ash_authentication_phoenix,ash_graphql '\
'--auth-strategy magic_link '\
'--with phx.new'
cd demo_app
devenv up
MIX_ENV=test mix ash.reset
mix test
See story.html for a full log of a generator run.
Devenv Features
Available devenv features:
- elixir - Elixir runtime (supports version specification, e.g.,
elixir=1.17
) - postgres - PostgreSQL database with project-specific databases
- redis - Redis cache/session store
- minio - MinIO object storage (S3-compatible)
- npm - Node.js runtime with npm
- bun - Bun runtime/package manager
The generator is built to be easily extendable, by creating an .eex
template file and adding it to the look-up table in devenv.new.ex
.
P.S.: This was supposed to be in “Announcements”, but I cannot create topics there.