-
Notifications
You must be signed in to change notification settings - Fork 40
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
bohendo
wants to merge
1
commit into
master
Choose a base branch
from
nix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add Nix support #143
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
{ | ||
description = "Medusa smart-contract fuzzer"; | ||
|
||
inputs = { | ||
nixpkgs.url = "nixpkgs/nixos-22.11"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; }; | ||
pyCommon = { | ||
format = "pyproject"; | ||
nativeBuildInputs = with pkgs.python39Packages; [ pythonRelaxDepsHook ]; | ||
pythonRelaxDeps = true; | ||
doCheck = false; | ||
}; | ||
in | ||
rec { | ||
|
||
packages = rec { | ||
|
||
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 | ||
]; | ||
}); | ||
|
||
crytic-compile = pkgs.python39Packages.buildPythonPackage (pyCommon // rec { | ||
pname = "crytic-compile"; | ||
version = "0.3.1"; | ||
src = builtins.fetchGit { | ||
url = "git+ssh://[email protected]/crytic/crytic-compile"; | ||
rev = "10104f33f593ab82ba5780a5fe8dd26385acd1c1"; | ||
}; | ||
propagatedBuildInputs = with pkgs.python39Packages; [ | ||
cbor2 | ||
pycryptodome | ||
setuptools | ||
packages.solc-select | ||
]; | ||
}); | ||
|
||
slither = pkgs.python39Packages.buildPythonPackage (pyCommon // rec { | ||
pname = "slither"; | ||
version = "0.9.3"; | ||
format = "pyproject"; | ||
src = builtins.fetchGit { | ||
url = "git+ssh://[email protected]/crytic/slither"; | ||
rev = "e6b8af882c6419a9119bec5f4cfff93985a92f4e"; | ||
}; | ||
nativeBuildInputs = with pkgs.python39Packages; [ pythonRelaxDepsHook ]; | ||
pythonRelaxDeps = true; | ||
doCheck = false; | ||
propagatedBuildInputs = with pkgs.python39Packages; [ | ||
packaging | ||
prettytable | ||
pycryptodome | ||
packages.crytic-compile | ||
]; | ||
postPatch = '' | ||
echo "web3 dependency depends on ipfs which is bugged, removing it from the listed deps" | ||
sed -i 's/"web3>=6.0.0",//' setup.py | ||
''; | ||
}); | ||
|
||
medusa = pkgs.buildGoModule { | ||
pname = "medusa"; | ||
version = "0.1.0"; # from cmd/root.go | ||
src = ./.; | ||
vendorSha256 = "sha256-odBzty8wgFfdSF18D15jWtUNeQPJ7bkt9k5dx+8EFb4="; | ||
nativeBuildInputs = [ | ||
packages.crytic-compile | ||
pkgs.solc | ||
pkgs.nodejs | ||
]; | ||
doCheck = false; # tests require `npm install` which can't run in hermetic build env | ||
}; | ||
|
||
default = medusa; | ||
|
||
}; | ||
|
||
apps = { | ||
default = { | ||
type = "app"; | ||
program = "${self.packages.${system}.medusa}/bin/medusa"; | ||
}; | ||
}; | ||
|
||
devShells = { | ||
default = pkgs.mkShell { | ||
buildInputs = with pkgs; [ | ||
packages.medusa | ||
bashInteractive | ||
# runtime dependencies | ||
packages.crytic-compile | ||
packages.slither | ||
solc | ||
# test dependencies | ||
nodejs | ||
# go development | ||
go | ||
gotools | ||
go-tools | ||
gopls | ||
go-outline | ||
gocode | ||
gopkgs | ||
gocode-gomod | ||
godef | ||
golint | ||
]; | ||
}; | ||
}; | ||
|
||
} | ||
); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 aflake.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 ofcrytic-compile
, etc