commit d0ca77d2a96f521229920ec0923317c090d65e31 Author: Nicolas Hiillos Date: Tue Aug 15 15:41:06 2023 +0300 Add nix cmake-init with temporary venv dir diff --git a/cmake-init.nix b/cmake-init.nix new file mode 100644 index 0000000..58b7e83 --- /dev/null +++ b/cmake-init.nix @@ -0,0 +1,42 @@ +{ pkgs ? import {} +}: +let + pythonPackages = pkgs.python3Packages; +in pkgs.mkShell rec { + name = "impurePythonEnv"; + venvDir = "/tmp/cmake-init_venv"; + buildInputs = [ + # A Python interpreter including the 'venv' module is required to bootstrap + # the environment. + pythonPackages.python + + # This executes some shell code to initialize a venv in $venvDir before + # dropping into the shell + pythonPackages.venvShellHook + + # Those are dependencies that we would like to use from nixpkgs, which will + # add them to PYTHONPATH and thus make them accessible from within the venv. + #pythonPackages.numpy + #pythonPackages.requests + pkgs.wget + + # In this particular example, in order to compile any binary extensions they may + # require, the Python modules listed in the hypothetical requirements.txt need + # the following packages to be installed locally: + # + ]; + + # Run this command, only after creating the virtual environment + #pip install -r requirements.txt + postVenvCreation = '' + unset SOURCE_DATE_EPOCH + pip install cmake-init + ''; + + # Now we can execute any commands within the virtual environment. + # This is optional and can be left out to run pip manually. + postShellHook = '' + unset SOURCE_DATE_EPOCH + ''; + +}