In this tutorial, you will learn how to add flake.nix
to an Elixir Phoenix project.
Initialize a new project
Make
mix
executable available:Install the scaffolder for Phoenix using
mix archive.install
command. You need to do this only once per machine:Use
mix phx.new
to scaffold a new project with your preferred options:Enter the directory:
Add flake.nix to the project
Initialize the template from the root directory of the project:
Open
flake.nix
and set the Erlang and Elixir versions:Add
.envrc
:Allow direnv:
Switch the language server
Lexical is the default language server for Elixir, but you can change it to a different one: