Cleanup error handling

This commit is contained in:
2023-03-19 18:06:38 +09:00
parent 6b9842c9d3
commit d4d223dbf0
3 changed files with 40 additions and 29 deletions
+25 -26
View File
@@ -1,28 +1,27 @@
{pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
packages = with pkgs; [
nodejs-16_x
nodePackages.yarn
(with dotnetCorePackages;
combinePackages [
sdk_6_0
aspnetcore_6_0
])
python3
python3Packages.venvShellHook
];
# Run this command, only after creating the virtual environment
{pkgs ? import <nixpkgs> {}}: let
venvDir = "./.venv";
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r ./scanner/requirements.txt
'';
pythonPkgs = ./scanner/requirements.txt;
in
pkgs.mkShell {
packages = with pkgs; [
nodejs-16_x
nodePackages.yarn
(with dotnetCorePackages;
combinePackages [
sdk_6_0
aspnetcore_6_0
])
python3
];
# Now we can execute any commands within the virtual environment.
# This is optional and can be left out to run pip manually.
postShellHook = ''
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';
}
shellHook = ''
# Install python modules
SOURCE_DATE_EPOCH=$(date +%s)
if [ ! -d "${venvDir}" ]; then
${pkgs.python3} -m venv "${venvDir}"
fi
source "${venvDir}/bin/activate"
export PIP_DISABLE_PIP_VERSION_CHECK=1
pip install -r ${pythonPkgs}
'';
}