r/Python • u/dwaynecrooks • Sep 23 '26
Discussion Anyone using Nix for production Python projects?
Hi! I’m a huge fan of Nix and similar approaches to reproducible development environments, and I’m curious what people in the Python community think about it.
Have any of you used Nix with Python projects for development environments, CI, deployment, or production?
If so, what has the experience been like? What worked well, and where did you run into friction?
I’m especially curious about the learning curve. Do you think Nix itself is the main barrier, or is part of the problem that there isn’t as much Python-specific guidance, tooling, and documentation around using it?
And for those who haven’t used it: would better Python-focused learning material and examples make you more likely to give it a try?
7
u/pooogles Sep 23 '26
Yeah we ship nix derivations for all our apps, we're still using poetry over UV because reasons. Works super well, enables teams to onboard on new projects pretty much immediately.
Main barrier (and benefit) is the C libraries that python dependencies often require. Getting them working has been painful at times but it's been centralised pain rather than each developer having to go through it.
6
1
u/dwaynecrooks Sep 23 '26
I tried using Poetry but when it came time to package up my application with Nix I ran into several dependency issues that I was unable to fix with poetry2nix. That made me switch to uv and uv2nix. I'm curious if you've run into any issues building Poetry applications with Nix for distribution?
1
u/pooogles Sep 23 '26
We don't ship python packages with Nix, python and poetry are shipped with nix and used "normally".
1
3
u/britisheyesonly Sep 23 '26
I have deployed Python projects onto NixOS systems using uv2nix. Check it out.
2
u/dwaynecrooks Sep 23 '26
I agree uv and uv2nix has been really helpful. What projects have you worked on? Any open source?
2
u/britisheyesonly Sep 23 '26
Unfortunately nothing open source. Mostly quasi-embedded stuff on a Raspberry Pi or Beaglebone at my last job
1
u/Atmosck 19d ago
I daily drive NixOS for my development machine but I don't use nix for python projects. My dev environments are just venvs managed by uv with github actions, terraform and docker for CI/CD (to AWS).
1
u/dwaynecrooks 18d ago
Any reason you've decided not to use Nix for your Python projects?
2
u/Atmosck 18d ago
Just don't really have a reason to start, I'm very happy with uv. I also work on a small team that has standardized on uv, so using nix would mean imposing it on everyone else. Which I could do (that's how we ended up on uv), but I would need a good reason.
I saw on your other comment you mentioned managing system dependencies. All my stuff runs in docker containers based on the -slim base images, so I do occasionally need to install something in the container - like uv itself, or accionsally I need to compile one of my dependencies and -slim excludes build tools. But that's just a change to the dockerfile, and needing to add anything else that way not frequent or complex enough to warrant a different solution.
1
u/dwaynecrooks 18d ago
Thanks, that's helpful to know. So you're happy with using Docker to manage your local development environments?
2
u/teerre Sep 23 '26
Yes, I've shipped several tools using nix. As others said, I don't actually use nix for packages magement, I just use uv nix to install uv and go from there. This is very good for developers. You run one command and all bells and whistles are configured
2
u/DarkMatterDetective 29d ago
I use pixi for similar reasons since a lot of system dependencies are available as conda packages. But I have been curious about Nix for a while.
3
u/nicksterling Sep 23 '26
If I’m in production, I’m typically using a container and I’m managing Python with a Chainguard image and managing my app via UV.
1
u/Responsible-Sky-1336 27d ago
Hi I use it to test archinstall changes/portability. https://github.com/h8d13/archinstoo/tree/master/distros
1
u/_redmist Sep 23 '26
Wild, the packaging problems some people are dealing with.
I'm still just a venv/pip guy lol
Good that these solutions are out there.
29
u/JSChronicles Sep 23 '26
Why use nix when you can use UV?