dapptools icon indicating copy to clipboard operation
dapptools copied to clipboard

Add flake support

Open wanderer opened this issue 3 years ago • 5 comments

Having flake support would make dapptools easier to work with when managing projects with nix's flakes.

wanderer avatar Nov 28 '21 10:11 wanderer

While we wait for proper flake support, here's my shell.nix, to avoid having to to use nix-env, if anyone finds it useful:

{ pkgs ? import <nixpkgs> {} }:
let
  dapp = import (builtins.fetchTarball https://github.com/dapphub/dapptools/archive/master.tar.gz) { };
in
pkgs.mkShell {
  buildInputs = with pkgs; [
    # other pkgs with current 'nixpkgs' go here
    # ...
    # dapptools packages
    dapp.dapp
    dapp.seth
    # ...
    # custom solc version in shell
    (dapp.runCommand "solc" { } "mkdir -p $out/bin; ln -s ${dapp.solc-static-versions.solc_0_8_10}/bin/solc-0.8.10 $out/bin/solc")
  ];
}

And to use the binary cache with the above, enable cachix use dapp, or add these nix config options to your host:

{
  nix = {
    binaryCaches = [
      "https://dapp.cachix.org"
    ];
    binaryCachePublicKeys = [
      "dapp.cachix.org-1:9GJt9Ja8IQwR7YW/aF0QvCa6OmjGmsKoZIist0dG+Rs="
    ];
  };
}

andrevmatos avatar Jan 04 '22 00:01 andrevmatos

one very easy win for flake compatibility (without writing a full on flake.nix for dapptools) would be to allow pure evaluation of the dapptools nix expressions.

d-xo avatar Jan 08 '22 12:01 d-xo

@andrevmatos it's a little off topic for this issue imo, but your shell.nix can IMO be made a little tidier by:

  1. pinning a specific dapptools commit and using the version of nixpkgs from the dapptools repo
  2. using the DAPP_SOLC env var to specify the custom solc version (see here for an example).

d-xo avatar Jan 08 '22 12:01 d-xo

flake is the now suggested method for install dapptools, this can be closed I would think.

Sadly,

flake 'github:dapphub/dapptools' does not provide attribute 'packages.aarch64-darwin.dapp', 'legacyPackages.aarch64-darwin.dapp' or 'dapp'

sambacha avatar Jul 13 '23 13:07 sambacha

@sambacha

I have flake installed but I still get the error below. Do you know a way around this error?

flake 'github:dapphub/dapptools' does not provide attribute 'packages.aarch64-darwin.dapp', 'legacyPackages.aarch64-darwin.dapp' or 'dapp'

PrintRH avatar Sep 28 '23 10:09 PrintRH