### Build and install commands Source: https://github.com/ydlr/mix2nix/blob/master/README.md Standard Nix commands for development, building, and installation. ```bash $ nix develop ``` ```bash $ nix build ``` ```bash $ nix profile install ``` -------------------------------- ### Hex.pm package tuple format Source: https://github.com/ydlr/mix2nix/blob/master/docs/Mix.lock Format.md Represents a package hosted on Hex.pm with versioning, hashes, build tools, and dependency lists. ```elixir { :hex, # declaring that it is a hex package :package, # an atom matching the package name (key) "0.8.0", # string representing the version "HASH", # a hash of the package contents [:mix, :rebar3], # a list of one or more build tools used by the package, as # atoms. As far as I can tell, any one of the build tools # listed should be sufficient to build the package. [ # A list of dependencies as tuples { :package, # an atom representing dependency "-> 1.9", # a string representing a version range. mix2nix currently # makes no attempt and ensuring this is satisfied. It just # converts the top-level packages in mix.lock into nix # expressions. [ hex: :package, # An atom that matches the atom used in the top-level map # to represent the package. repo: "hexpm", # Repo that hosts the package source optional: false # Whther the dependency is required. If it is, there # should also be an entry for it in the top-level map. # Whether there is a top-level entry or not, mix2nix # will include this in `beamDeps` list in the generated # nix expression for the parent package. ] } ], "hexpm", # Possibly the repo where the found is found. I've # always seen it as "hexpm", but it might be different # if the package is hosted in a different Hex # repository. mix2nix only supports public packages # hosted on Hex.pm. "HASH" # Another package hash. Different from the first one. } ``` -------------------------------- ### Import generated expressions in default.nix Source: https://github.com/ydlr/mix2nix/blob/master/README.md Integrate the generated dependency set into a standard Nix buildMix derivation. ```nix { pkgs ? import {} }: with pkgs; with beamPackages; let deps = import ./deps.nix { inherit lib beamPackages; }; in buildMix rec { name = "example-package"; src = ./.; version = "0.0.0"; beamDeps = [ deps.package1 deps.package2 ]; } ``` -------------------------------- ### Generate Nix expression set Source: https://github.com/ydlr/mix2nix/blob/master/README.md Generate Nix expressions from a mix.lock file and output to a file. ```bash $ mix2nix > deps.nix ``` ```bash $ mix2nix /path/to/mix.lock > deps.nix ``` -------------------------------- ### Git source package tuple format Source: https://github.com/ydlr/mix2nix/blob/master/docs/Mix.lock Format.md Represents a package sourced from a Git repository, specifying the URL, hash, and version reference. ```elixir { :git, # declaring that it is a git package "https://git.imnotsoup.com/mix2nix", # URL of git repo "HASH", # A hash of package [branch: "branchname"] # a keyword list representing the # package version. Can be a branch # (:branch), tag (:tag), or commit # ref (:ref) } ``` -------------------------------- ### Use generated expressions in mixRelease Source: https://github.com/ydlr/mix2nix/blob/master/README.md Integrate the generated dependency set into a mixRelease derivation for packaging applications. ```nix { pkgs ? import {} }: with pkgs; with beamPackages; mixRelease { pname = "example-release"; src = ./.; version = "0.0.0"; mixNixDeps = import ./deps.nix { inherit lib beamPackages; }; } ``` -------------------------------- ### Top-level mix.lock structure Source: https://github.com/ydlr/mix2nix/blob/master/docs/Mix.lock Format.md The root of the mix.lock file is a map containing package names as keys. ```elixir %{ "package_name": { }, "second_package": { } } ``` -------------------------------- ### Override package definitions Source: https://github.com/ydlr/mix2nix/blob/master/README.md Modify specific package attributes by passing an overrides function to the generated dependency set. ```nix let deps = import ./deps.nix { inherit lib beamPackages; overrides = overrideDeps; }; overrideDeps = (self: super: { package1 = super.package1.override { enableDebugInfo = true; compilePorts = true; }; }); in ... ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.