Skip to content

Fix several problems with the nix setup. - #546

Merged
sbs2001 merged 3 commits into
aboutcode-org:mainfrom
ngi-nix:fix-nix-setup
Sep 11, 2021
Merged

Fix several problems with the nix setup.#546
sbs2001 merged 3 commits into
aboutcode-org:mainfrom
ngi-nix:fix-nix-setup

Conversation

@rolfschr

Copy link
Copy Markdown
Contributor

This PR fixes several issues with the Nix setup. Note that the GitHub actions still doesn't run. I don't know what exactly the problem is but have reported it upstream (DavHau/mach-nix#318).

Signed-off-by: Rolf Schröder rolf.schr@gmail.com

Comment thread etc/nix/flake.nix
postPatch = ''
# Make sure the pycodestyle binary in $PATH is used.
substituteInPlace vulnerabilities/tests/test_basics.py \
--replace 'join(bin_dir, "pycodestyle")' '"pycodestyle"'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pycodestyle is not used anymore.

Comment thread etc/nix/flake.nix
name = "vulnerablecode-${version}";
src = vulnerablecode-src;
dontConfigure = true; # do not use ./configure
dontBuild = true; # do not use Makefile

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

configure doesn't exist anymore, Makefile was added.

Comment thread etc/nix/flake.nix
buildPhase = ''
source ${libSh}
initPostgres $(pwd)
export SECRET_KEY=REALLY_SECRET

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ce64bce removed the DJANGO_DEV=1 setting, I would guess without testing it: Setting neither DJANGO_DEV=1 nor the SECRET_KEY results in an error.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, DJANGO_DEV is not present now. Please use make envfile. A basic make based run is at https://github.com/nexB/vulnerablecode/blob/main/.github/workflows/main.yml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Hritik14 Thanks, if I understand you correctly, you suggest to run make dev envfile (https://github.com/nexB/vulnerablecode/blob/main/.github/workflows/main.yml#L24). The dev target makes no sense since the Nix setup doesn't run pip -r requirements on purpose. As for the envfile target, it creates the file but uses the non-deterministic urandom source, which is not feasible in Nix. I'm not convinced it is better to use make than to simply set the env var as I proposed here.

@sbs2001

sbs2001 commented Sep 8, 2021

Copy link
Copy Markdown
Collaborator

@rolfschr is this good to merge ?

@rolfschr

rolfschr commented Sep 8, 2021

Copy link
Copy Markdown
Contributor Author

Yes, I think so.

@sbs2001

sbs2001 commented Sep 9, 2021

Copy link
Copy Markdown
Collaborator

@rolfschr Could you rebase please ?

Signed-off-by: Rolf Schröder <rolf.schr@gmail.com>
Signed-off-by: Rolf Schröder <rolf.schr@gmail.com>
@sbs2001

sbs2001 commented Sep 10, 2021

Copy link
Copy Markdown
Collaborator

): now tests fail

Signed-off-by: Rolf Schröder <rolf.schr@gmail.com>
@sbs2001
sbs2001 merged commit a0a733a into aboutcode-org:main Sep 11, 2021
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.

3 participants