Installing Python packages in isolated environments with pipx

Hi!,

Here a new enthusiastic Nix user :slight_smile:. After hearing about all the good things that immutable systems would bring to my developer life, I decided to start playing around with Nix, and specifically, with Home Manager.

So far, very happy with the results. As advised in multiple blogs, I started small, slowly migrating my Ansible playbook which contains most of the programs and configurations I have across machines.

Today I reached a new milestone: my Python development environment.

I use for development some tools like iptyhon or the esptool that are native Python packages, but that I like to keep independent of the System’s python environment, being installed and isolated in their own environment. This saves some trouble with potential incompatible library versions.

Currently, I do this via pipx. But I’m not sure how to use Nix and Pipx for installing the packages.

How can I install Python packages using pipx in a Nix file?

PD: Could be that I’m thinking “in the wrong direction”. If so, please take my thoughts in the right path :wink:

1 Like