crytic-compile icon indicating copy to clipboard operation
crytic-compile copied to clipboard

Justify + Nixify

Open bohendo opened this issue 2 years ago • 1 comments

Introduces 2 new files: justfile and flake.nix in the project root. These provide a few new commands that are helpful for developers:

  • just build: build an executable which will be available via a symlink at ./result/bin/crytic-compile
  • just install: after building, install the built result (aka add it to PATH) so that it's available by just typing crytic-compile
  • just dev: pre-packaged, hermetically sealed dev environment, no virtualenvwrapper needed. This command will open a new shell that exposes a temporary and hot-reloadable crytic-compile, this executable will update when the source code changes for a quick and easy tweak/check cycle. (TODO: this works nicely with nix-shell shell.nix but is not hot-reloadable via flake.nix, I should fix this)
  • just lint: runs black, darglint, mypy, and pylint code formatters/linters
    • just black: runs only the black code formatter (ditto for the other lint commands)
  • just test: runs all available tests (only hardhat and monorepo tests for now, more coming soon)
    • just test-hardhat: runs only the hardhat tests locally (also works with monorepo)

Keep in mind:

  • The above commands require nix and just to be installed. If nix is already installed, you can install just with nix-env -iA nixpkgs.just or add it to your configuration.nix file if you're using NixOS/nix-darwin.
  • The above commands utilize isolated dependencies so they will not interfere with any other python tools that you've already installed via homebrew, apt, pip, virtualenvwrapper, etc.
  • The prev point is nice but it has a downside: on the first run, all dependencies need to be downloaded so it will take some time and plenty of bandwidth. The second run of just lint should take on the order of 20 seconds and negligible bandwidth. Luckily, if some other project requires the same dependencies, they'll be cached & won't need to be downloaded again. The dependencies required to run the build, dev, and lint commands overlap but are not identical so each one will take a while to run the first time.
  • The above is accomplished without modifying any of the existing configuration files. If you dislike just and/or nix, ignore these few new files & continue developing as you always have, nothing else should be impacted.

bohendo avatar Jan 03 '23 22:01 bohendo

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


bohendo seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Jul 20 '24 07:07 CLAassistant