This is an automated archive made by the Lemmit Bot.

The original was posted on /r/nixos by /u/Florence-Equator on 2025-10-07 06:58:50+00:00.


Hi everyone,

Nix already packages a lot of popular Python tools like ranger and youtube-dl as standalone applications. This means you can install them without worrying about messing up your global Python environment.

But what if you want to use a Python application that Nix doesn’t package out of the box?

There are a couple of scenarios. If the tool and its dependencies aren’t in Nixpkgs at all, you’d have to use buildPythonApplication, which is a bit more involved. You can find details on that in the Nixpkgs manual.

However, I want to share a super simple solution for the other case: the Python module is available in Nixpkgs, but it’s not set up as a standalone application. In this situation, Nix has a fantastic one-liner for you.

Let’s say you want to use jupytext as a command-line tool. All you need to do is add this to your configuration:

nix packages = with pkgs; [ (python3Packages.toPythonApplication python3Packages.jupytext) ];

And that’s it! The jupytext command is now available in your PATH, completely self-contained. No global environment clutter.

This handy function is actually in the Nixpkgs documentation, but the manual is huge, and it’s easy to miss gems like this. Since this is such a simple and useful trick, I thought it deserved its own post.

I’m still fairly new to Nix myself and learning as I go, so I hope this helps someone else out!