nix-giant / nix-dev-templates

A collection of Nix flake templates for development.
5 stars 1 forks source link

Integrate `mix2nix` for Nix + Mix dependency caching #1

Closed mikehostetler closed 1 month ago

mikehostetler commented 1 month ago

Have you looked into mix2nix at all?

https://medium.com/gamezop/building-elixir-applications-mix-with-nix-part-1-90936e8f5c42

c4710n commented 1 month ago

Yes, I know mix2nix. Creating and using fetchMixDeps is simply a matter of preference.

When using mix2nix, we have to create deps.nix which is generated from mix.lock. In this way, we can have more fine-grained cache control, but it'll create many nix expressions just for deps. That's not what I want.

I like the method used by fetchNpmDeps - treating all dependencies as a whole. so I create fetchMixDeps. In this way, although cache control is not that fine-grained, considering dependencies don't change frequently, I think this is acceptable.

mikehostetler commented 1 month ago

Understood and makes sense! I'm learning nix on Elixir and your repo helped a lot - thanks