Skip to content

Commit

Permalink
add experimental shell.nix for cli venv
Browse files Browse the repository at this point in the history
This allows the automatic creation and registration of a virtualenv when
running `nix-shell` within the `cli` directory, mimicking the
environment you would get from creating the virtual environment in the
usual way.

Note that the current shell does not work well with software like
`lorri`, supposedly because the shell performs impure operations
(calling out to a server via `pip`).
  • Loading branch information
Ptival committed Jan 8, 2021
1 parent d3fc4c9 commit 32681ed
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cli/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ nixpkgs ? import <nixpkgs> {}
}:
let
myPythonPackages = nixpkgs.python39Packages;
in
nixpkgs.mkShell {

buildInputs = with nixpkgs; [
git
myPythonPackages.python
myPythonPackages.venvShellHook
];

postVenvCreation = ''
pip install -r ${./requirements.txt}
'';

venvDir = ".venv";

}

0 comments on commit 32681ed

Please sign in to comment.