-
-
Notifications
You must be signed in to change notification settings - Fork 328
Fix several problems with the nix setup. #546
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,30 +61,40 @@ | |
| pypiDataSha256 = | ||
| "0499zl39aia74f0i7fkn5dsy8244dkmcw4vzd5nf4kai605j2jli"; | ||
| }); | ||
| # This wrapper allows to setup both the production as well as the | ||
| # development Python environments in the same way (albeit having | ||
| # different requirements.txt). | ||
| getPythonEnv = system: requirements: | ||
| machnixFor.${system}.mkPython { | ||
| requirements = '' | ||
| ${requirements} | ||
| ''; | ||
| # Fix an issue with an upstream dep of GitPython. | ||
| # https://github.com/DavHau/mach-nix/issues/287 | ||
| # See https://github.com/DavHau/mach-nix/issues/318 | ||
| _.gitpython.propagatedBuildInputs.mod = pySelf: self: oldVal: | ||
| oldVal ++ [ pySelf.typing-extensions ]; | ||
| }; | ||
|
|
||
| in { | ||
|
|
||
| # A Nixpkgs overlay. | ||
| overlay = final: prev: | ||
| with final.pkgs; { | ||
|
|
||
| pythonEnv = machnixFor.${system}.mkPython { | ||
| requirements = '' | ||
| ${requirements} | ||
| ''; | ||
| }; | ||
| pythonEnv = getPythonEnv system requirements; | ||
|
|
||
| vulnerablecode = stdenv.mkDerivation { | ||
| inherit version; | ||
| name = "vulnerablecode-${version}"; | ||
| src = vulnerablecode-src; | ||
| dontConfigure = true; # do not use ./configure | ||
| dontBuild = true; # do not use Makefile | ||
| propagatedBuildInputs = [ pythonEnv postgresql gitMinimal ]; | ||
|
|
||
| postPatch = '' | ||
| # Make sure the pycodestyle binary in $PATH is used. | ||
| substituteInPlace vulnerabilities/tests/test_basics.py \ | ||
| --replace 'join(bin_dir, "pycodestyle")' '"pycodestyle"' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| # Do not use absolute path. | ||
| substituteInPlace vulnerablecode/settings.py \ | ||
| --replace 'STATIC_ROOT = "/var/vulnerablecode/static"' 'STATIC_ROOT = "./static"' | ||
| ''; | ||
|
|
||
| installPhase = '' | ||
|
|
@@ -117,12 +127,10 @@ | |
| # Tests run by 'nix flake check' and by Hydra. | ||
| checks = forAllSystems (system: | ||
| let | ||
| pythonEnvDev = machnixFor.${system}.mkPython { | ||
| requirements = '' | ||
| ${requirements} | ||
| ${requirementsDev} | ||
| ''; | ||
| }; | ||
| pythonEnvDev = getPythonEnv system '' | ||
| ${requirements} | ||
| ${requirementsDev} | ||
| ''; | ||
|
|
||
| in { | ||
| inherit (self.packages.${system}) vulnerablecode; | ||
|
|
@@ -138,6 +146,8 @@ | |
| buildPhase = '' | ||
| source ${libSh} | ||
| initPostgres $(pwd) | ||
| export SECRET_KEY=REALLY_SECRET | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ce64bce removed the
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Hritik14 Thanks, if I understand you correctly, you suggest to run |
||
| ${vulnerablecode}/manage.py collectstatic --no-input | ||
| ${vulnerablecode}/manage.py migrate | ||
| ''; | ||
|
|
||
|
|
||
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.
configuredoesn't exist anymore,Makefilewas added.