water
Locally deploy phoenix liveview using nix
Are there any known working resources to package using nix and deploy it?
I’ve tried:
But the basic liveview(mix phx.new) uses heroicons and I get errors when building it.
nix build
...
> Running phase: installPhase
> Unchecked dependencies for environment prod:
> * heroicons (https://github.com/tailwindlabs/heroicons.git - v2.1.1)
> lock mismatch: the dependency is out of date. To fetch locked version run "mix deps.get"
> ** (Mix) Can't continue due to errors on dependencies
...
Marked As Solved
Zurga
I think the problem is that the deps folder already exists in the build environment. This could be because the flake.nix has src = ./.;. This is a great resource for learning how to include only the files you need in the build environment: Working with local files — nix.dev documentation
To clarify a bit more, buildMix is going to get all the deps and compile them again based on the deps.nix contents.
Also Liked
Zurga
Nice to get it working!
I was doing some refactoring last night to make my script a bit more modular. The progress is on GitHub - Zurga/phoenix_nix · GitHub
munksgaard
I’ve found the best resource to be the BEAM section of the nixpkgs manual. We’re currently building and deploying our platform using nix, and I used that guide as a starting point for the implementation.
I’ve been meaning to write a proper blog post about this at some point, but haven’t gotten around to it yet.
Do you have any specific questions you’d like help with?
Edit: You did actually pose a question, so let me try to help out:
But the basic liveview(
mix phx.new) uses heroicons and I get errors when building it.
What does your mix.exs and flake.nix look like?
Zurga
Maybe try to doing aMIX_ENV=prod mix deps.get. If there is a lock mismatch, this could solve it.
I am not a big fan of just throwing your working directory in as source. Any changes made to files that are not related would result in a rebuild of everything, and all files in directory that are not related to a deployment would also be included. I suggest using the documentation provided and mix2nix for dependencies.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








