NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.6k stars 13.76k forks source link

RFC fixing build-mix #105002

Closed happysalada closed 3 years ago

happysalada commented 3 years ago

Describe the bug Running the build-mix helper on a Phoenix project fails with ** (Mix) The task "compile.phoenix" could not be found. Did you mean "compile.elixir"? The problem is that the depencies are not available to the builder. Therefore this problem is not unique to Phoenix projects.

To Reproduce Steps to reproduce the behavior:

  1. On a fresh phoenix project
  2. try to build with the following for example
    let
    nixpkgs = import '<nixpkgs>';
     packages = nixpkgs.beam.packagesWith nixpkgs.beam.interpreters.erlangR23;
    in
    packages.buildMix {
    name = "union";
    src = builtins.fetchGit {
    url = "ssh://git@github.com/happysalada/union";
    rev = "5c1253231b7d37a45e14671ff37888173980e082";
    };
    elixir = nixpkgs.beam.packages.erlangR23.elixir_1_11;
    version = "0.3.8";
    }

    This particular repo is private, but any public phoenix repo will do

I don't know how long this has been broken. Perhaps it's not supposed to be used in the way I'm using. Perhaps @DianaOlympos @NobbZ @Parasrah have an opinion

My idea with this issue would be more to discuss ways of solving this.

I think everybody is aware of https://github.com/hauleth/nix-elixir. It seems to me that the override provided there in buildMix' is the best alternative so far. Of course we can't integrate those changes upstream without @hauleth 's approval. I was under the impression he did not want to maintain it.

If that works for everybody, I'm proposing that we integrate those changes into nixpkgs.

I'm aware that everybody is busy and that this might take quite some time to figure out. I'm available to make PRs, be a maintainer, or just test things.

For the good of the community I hope we can move this issue forward.

@ericbmerritt @yorickvP @elitak Would be happy to hear your thoughts if you have time

Additional context Add any other context about the problem here.

Metadata Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
happysalada commented 3 years ago

The last comment on the discussion started was that the format of the mix.lock file was fairly stable at this point. I think we can try to get a mix2nix merged in nixpkgs. It might require effort from the maintainers. I am personally willing to maintain it and help get this merged. I've created an issue https://github.com/ydlr/mix2nix so that the author would make a PR. @petabyteboy if you want to make a PR with your copy, I would be glad to review and help you merge it. If anybody knows anybody else having a version and wanting to contribute, it would be good to contact them. I can make the contact and follow up in case you need.

minijackson commented 3 years ago

@happysalada Could you link the discussion on the google group? I couldn't find it with a quick search

happysalada commented 3 years ago

My bad for not putting it earlier! https://groups.google.com/g/elixir-lang-core/c/kXrSrvCRC3s

nixos-discourse commented 2 years ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/whats-the-current-best-in-class-approach-to-packaging-elixir-erlang-beam-applications-using-nix-releases-as-of-july-2020/8205/11