Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Nix support #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add Nix support #143

wants to merge 1 commit into from

Conversation

bohendo
Copy link

@bohendo bohendo commented May 2, 2023

Once merged to the default branch, this PR should allow anyone with nix installed to run nix run github:crytic/medusa to use the medusa tool without installing anything globally. Kind of like a single-serving virtualenv. The first time this is run, it'll take some time as medusa's dependencies (eg slither) are downloaded & the project is built, but subsequent runs will start almost instantly without requiring any further downloads. More info re nix run.

Allows global installation of medusa with: nix build && nix-env -i ./result. This medusa installation is hooked up to a new copy of required dependencies, so it'll take care of the slither dependency if not already present but w/out any risk of conflict w existing global slither installation.

Also provides a developer environment via nix develop which opens a shell that includes basic golang tools & other dependencies needed to build & run tests.

This is entirely opt-in, it uses the rest of the repo's config (eg go.mod) rather than attempting to replace it. If you don't want to fiddle with nix, then you can ignore these new files & do the same thing you've always done.

Comment on lines +24 to +36
solc-select = pkgs.python39Packages.buildPythonPackage (pyCommon // {
pname = "solc-select";
version = "1.0.3";
src = builtins.fetchGit {
url = "git+ssh://[email protected]/crytic/solc-select";
rev = "97f160611c39d46e27d6f44a5a61344e6218d584";
};
propagatedBuildInputs = with pkgs.python39Packages; [
packaging
setuptools
pycryptodome
];
});
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In-line addition of nix support to solc-select & other packages that don't feature a flake.nix file yet. If/when they do, these pieces of config can move into their respective repos & can be removed from this project.
In the meantime, they allow medusa to depend on a specific commit of crytic-compile, etc

@CLAassistant
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants