Flakify
View SourceEasily set up a Nix flake-based development environment for your Elixir/Phoenix-project.
Usage
To create a new Phoenix project that's already initialized with a Nix flake, run the following command:
mix igniter.new flakify_test --install flakify --with phx.new --with-args="--no-ecto"
This will:
Add a
flake.nix
with a development shell that contains elixir, tailwind and esbuild. And also sets theMIX_TAILWIND_PATH
andMIX_ESBUILD_PATH
environment variables.Modify
config/config.exs
such that theesbuild
andtailwind
configurations useMIX_ESBUILD_PATH
andMIX_TAILWIND_PATH
respectively to find the corresponding executables.
After performing the install, you should be able to run nix develop -c mix phx.server
to run the Phoenix server using the flake development environment.
In an existing project, you can run:
mix igniter.install flakify
After running the installer, flakify will remove itself from your project dependencies.
TODO
- [ ] Add option to also add a package definition to
flake.nix
, probably usingdeps_nix
. - [ ] Add option to specify whether tailwind and esbuild should actually be installed.
- [ ] Add option to add an .envrc file for direnv
- [ ] Add option to specify the nixos/nixpkgs version to use
- [ ] Add option to specify which version of elixir/beam to use
- [ ] Add option to add a nixos module definition and/or systemd service definition