Skip to content

Instantly share code, notes, and snippets.

@mtrsk
Created June 24, 2020 20:14
Show Gist options
  • Save mtrsk/88fdb6f88502607262ae02f181861037 to your computer and use it in GitHub Desktop.
Save mtrsk/88fdb6f88502607262ae02f181861037 to your computer and use it in GitHub Desktop.
Multiple Python versions with poetry2nix
{ pkgs ? import <nixpkgs> {} }:
let
makeEnv = python: pkgs.poetry2nix.mkPoetryEnv {
python = python;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
overrides = [
pkgs.poetry2nix.defaultPoetryOverrides
(self: super: {
# overridding python-box
python-box = super.python-box.overridePythonAttrs(old: {
buildInputs = old.buildInputs ++ [
self.pytestrunner
];
});
})
];
};
in
{
py38 = makeEnv pkgs.python38;
}
@mtrsk
Copy link
Author

mtrsk commented Jun 24, 2020

To run:

nix-shell -A py38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment