Skip to content

rebar-only git dependencies are detected as mix projects #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
adamcstephens opened this issue Mar 4, 2025 · 3 comments
Open

rebar-only git dependencies are detected as mix projects #12

adamcstephens opened this issue Mar 4, 2025 · 3 comments

Comments

@adamcstephens
Copy link
Contributor

For example, adding this dep

{:mnesia_eleveldb,
 git: "https://github.com/klarna/mnesia_eleveldb",
 ref: "af6d0556a78aec2918b3471f0c85121402a1f5b1"}

Results in

mnesia_eleveldb =
  let
    version = "af6d0556a78aec2918b3471f0c85121402a1f5b1";
    drv = buildMix {
      inherit version;
      name = "mnesia_eleveldb";
      appConfigPath = ./config;

      src = pkgs.fetchFromGitHub {
        owner = "klarna";
        repo = "mnesia_eleveldb";
        rev = "af6d0556a78aec2918b3471f0c85121402a1f5b1";
        hash = "sha256-+ZZ5Uyoe/HK0wL0ev1vn9Tuiaps4X88izETtuRszKYE=";
      };

      beamDeps = [
        proper
        eleveldb
      ];
    };
  in
  drv;

Which will not build, as the repo https://github.com/klarna/mnesia_eleveldb has no mix project file.

It looks like mix doesn't put the build manager in the lock file even if specified with manager: :rebar3, but could deps_nix maybe inspect the out path after fetching to verify?

@camelpunch
Copy link
Contributor

Interesting. I get an earlier error with that package, because it looks like rebar is attempting to modify my global (read-only, because nix) git config!

This is obviously not ideal as many users will be using nix to manage their git config. It's orthogonal to your issue, though. Thanks for the PR - will take a look.

$ mix deps.nix
===> Fetching eqc_rebar (from {git,"https://github.com/Quviq/eqc-rebar",{branch,"master"}})
===> Analyzing applications...
===> Compiling eqc_rebar
===> Fetching pc v1.15.0
===> Analyzing applications...
===> Compiling pc
make: Entering directory '/home/andrew/workspace/deps_nix/fixtures/example/deps/eleveldb/c_src'
git config --global --add safe.directory /__w/eleveldb/eleveldb
error: could not lock config file /home/andrew/.config/git/config: Read-only file system
make: *** [Makefile:37: get-deps] Error 255
make: Leaving directory '/home/andrew/workspace/deps_nix/fixtures/example/deps/eleveldb/c_src'
===> Hook for compile failed!

** (Mix) Could not compile dependency :eleveldb, "/home/andrew/.mix/elixir/1-18/rebar3 bare compile --paths /home/andrew/workspace/deps_nix/fixtures/example/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile eleveldb --force", update it with "mix deps.update eleveldb" or clean it with "mix deps.clean eleveldb"

@adamcstephens
Copy link
Contributor Author

Yeah, that is less than ideal. I forked their repo and have cleaned a few things up, including that git config call.

@adamcstephens
Copy link
Contributor Author

FYI, this is only resolved for github but not git repositories.

@camelpunch camelpunch reopened this Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants