View Source mix deps.nix (deps_nix v0.3.0)

Creates Nix derivations for Mix dependencies.

When run without arguments, generates deps.nix in the current directory, but only for :prod dependencies.

The resulting file contains a Nix function that can be called with an empty attribute set:

pkgs.callPackages ./deps.nix { }

That attribute set can optionally include overrides, which look like Nix overlays:

pkgs.callPackages ./deps.nix {
  overrides = (final: prev: with pkgs.beamPackages; {
    some_mix_dep = prev.some_mix_dep.override {
      mixEnv = "dev";
    }
  };
}

Example with all options

This command creates derivations for everything in :prod, and only ex_doc and credo in :dev. It outputs the Nix expression to nix/deps.nix.

mix deps.nix --env prod --env dev=ex_doc,credo --output nix/deps.nix

Git dependencies

deps_nix supports git dependencies.

builtins.fetchGit is used, which doesn't require any prefetching and relies on the git SHA as a unique identifier.