Skip to content

What would you recommend for installing custom binaries from crates.io? #70

Answered by ipetkov
dpc asked this question in Q&A
Discussion options

You must be logged in to vote

You'd need to package the tool just like you would any other program. buildPackage can totally do that for you, the only difference being using a remote fetcher instead of a local path for src:

# Fetch from github:
craneLib.buildPackage rec {
  pname = "somecrate";
  version = "0.0.1";

  src = pkgs.fetchFromGitHub {
    owner = "someowner";
    repo = "somerepo";
    rev = "v${version}";
    sha256 = "...";
  };

  # set buildInputs/nativeBuildInputs as appropriate
}
# Fetch from crates.io
craneLib.buildPackage rec {
  pname = "somecrate";
  version = "0.0.1";

  src = pkgs.fetchCrate {
    inherit pname version;
    sha256 = "...";
  };

  # set buildInputs/nativeBuildInputs as appropriate

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@dpc
Comment options

@ipetkov
Comment options

@dpc
Comment options

Answer selected by dpc
Comment options

You must be logged in to vote
1 reply
@ipetkov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants