Hi @mikhail.zholobov!
flox
could be used in few ways depending on your level of nix
knowledge. My favorite way (and also a way that requires the least amount of Nix knowledge, if any) is to use flox
to provide all the packages you would usually need to use your system package manager.
Lets look at your example and try to create a flox
environment that will provide correct python version as well as all the system level tools.
1. Search for your python version
As I see from your Pipfile
you are using python 3.9, lets look which version is available in flox
.
$ nix search python39
python39 - A high-level dynamically-typed programming language
stable.nixpkgs-flox.python39@3.9.14
stable.nixpkgs-flox.python39@3.9.15
stable.nixpkgs-flox.python39@3.9.16
staging.nixpkgs-flox.python39@3.9.14
staging.nixpkgs-flox.python39@3.9.15
staging.nixpkgs-flox.python39@3.9.16
unstable.nixpkgs-flox.python39@3.9.14
unstable.nixpkgs-flox.python39@3.9.15
unstable.nixpkgs-flox.python39@3.9.16
python39Full - A high-level dynamically-typed programming language
stable.nixpkgs-flox.python39Full@3.9.14
stable.nixpkgs-flox.python39Full@3.9.15
stable.nixpkgs-flox.python39Full@3.9.16
staging.nixpkgs-flox.python39Full@3.9.14
staging.nixpkgs-flox.python39Full@3.9.15
staging.nixpkgs-flox.python39Full@3.9.16
unstable.nixpkgs-flox.python39Full@3.9.14
unstable.nixpkgs-flox.python39Full@3.9.15
unstable.nixpkgs-flox.python39Full@3.9.16
The difference between python39
and python39Full
is that the Full
package comes with all extra dependencies that you usually want python to come with (eg. openssl, curses, …).
At the time of writing the latest release of python 3.9 (from python.org) is 3.9.16
which is what is also available in flox
. There are also other older versions available.
2. Create flox
environment with python
$ flox install -e py39-pipenv stable.nixpkgs-flox.python39Full
created generation 1
We just created a flox
environment called py39-env
with python 3.9.
If we don’t specify the exact version flox
will always choose the latest one.
3. Adding pipenv
to the environment
$ flox search pipenv
pipenv - Python Development Workflow for Humans
stable.nixpkgs-flox.pipenv@2022.10.12
stable.nixpkgs-flox.pipenv@2022.11.11
stable.nixpkgs-flox.pipenv@2022.11.25
staging.nixpkgs-flox.pipenv@2022.10.25
staging.nixpkgs-flox.pipenv@2022.11.11
staging.nixpkgs-flox.pipenv@2022.11.25
unstable.nixpkgs-flox.pipenv@2022.10.25
unstable.nixpkgs-flox.pipenv@2022.11.11
unstable.nixpkgs-flox.pipenv@2022.11.25
$ flox install -e py39-pipenv stable.nixpkgs-flox.pipenv
created generation 2
4. Using py39-pipenv
environment
$ flox activate -e py39-pipenv
flox [py39-pipenv default] [rok@cercei:~/tmp]$ ls -la
-rw-r--r-- 1 rok users 196 Feb 9 12:39 Pipfile
-rw-r--r-- 1 rok users 4733 Feb 9 12:37 test.xlsx
flox [py39-pipenv default] [rok@cercei:~/tmp]$ pipenv shell
flox [py39-pipenv default] [rok@cercei:~/tmp]$ xlsx2csv test.xlsx
A1,B1,C1
A2,B2,C2
Final thoughts
So flox
can be used to provide the correct version of python
, pipenv
and any other system package that you might require. After that you activate flox environment and use pipenv
as you are used to.
Now this is a short way how to start using flox
today without the need to learn any Nix.
There are also other things you can do with it and I would invite you to checkout out the documentation.
And if you have any questions just ask them right here.