Skip to content

Commit 56a8ac9

Browse files
committed
Fix several problems with the nix setup.
Signed-off-by: Rolf Schröder <rolf.schr@gmail.com>
1 parent bd1dfe5 commit 56a8ac9

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

etc/nix/flake.nix

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@
7878
inherit version;
7979
name = "vulnerablecode-${version}";
8080
src = vulnerablecode-src;
81-
dontConfigure = true; # do not use ./configure
81+
dontBuild = true; # do not use Makefile
8282
propagatedBuildInputs = [ pythonEnv postgresql gitMinimal ];
8383

8484
postPatch = ''
85-
# Make sure the pycodestyle binary in $PATH is used.
86-
substituteInPlace vulnerabilities/tests/test_basics.py \
87-
--replace 'join(bin_dir, "pycodestyle")' '"pycodestyle"'
85+
# Do not use absolute path.
86+
substituteInPlace vulnerablecode/settings.py \
87+
--replace 'STATIC_ROOT = "/var/vulnerablecode/static"' 'STATIC_ROOT = "./static"'
8888
'';
8989

9090
installPhase = ''
@@ -138,6 +138,8 @@
138138
buildPhase = ''
139139
source ${libSh}
140140
initPostgres $(pwd)
141+
export SECRET_KEY=REALLY_SECRET
142+
${vulnerablecode}/manage.py collectstatic
141143
${vulnerablecode}/manage.py migrate
142144
'';
143145

etc/nix/test-import-using-nix.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1010
DEFAULT_INSTALL_DIR=$VULNERABLECODE_INSTALL_DIR # in the Nix store, see flake.nix
1111
INSTALL_DIR=${INSTALL_DIR:-$DEFAULT_INSTALL_DIR}
1212
ARGS=$(if [ $# -eq 0 ]; then echo "--all"; else echo "$@"; fi)
13+
export SECRET_KEY=REALLY_SECRET
1314
TEMPDIR=$(mktemp -d -p "$THIS_DIR")
1415
export TEMPDIR
1516

@@ -25,4 +26,5 @@ trap cleanup EXIT
2526
initPostgres "$TEMPDIR"
2627

2728
"$INSTALL_DIR/manage.py" migrate
29+
"$INSTALL_DIR/manage.py" collectstatic
2830
"$INSTALL_DIR/manage.py" import $ARGS

0 commit comments

Comments
 (0)