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

Merged
merged 3 commits into from
Jan 6, 2025
Merged

Add Nix support #143

merged 3 commits into from
Jan 6, 2025

Conversation

bohendo
Copy link
Contributor

@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.

@bohendo bohendo requested review from Xenomega and anishnaik as code owners May 2, 2023 19:40
flake.nix Outdated
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
Contributor 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

CLAassistant commented Jul 20, 2024

CLA assistant check
All committers have signed the CLA.

@bsamuels453 bsamuels453 self-assigned this Jan 6, 2025
@bsamuels453 bsamuels453 self-requested a review January 6, 2025 18:46
Copy link
Contributor

@bsamuels453 bsamuels453 left a comment

Choose a reason for hiding this comment

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

lgtm, over the long term we should add nix to our to-be-created release pipeline to ensure the vendorhash is correct

@bsamuels453 bsamuels453 merged commit 225d2ee into master Jan 6, 2025
12 checks passed
@bsamuels453 bsamuels453 deleted the nix branch January 6, 2025 19:39
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.

4 participants