Hacker News new | ask | show | jobs
by otabdeveloper4 1092 days ago
nixpkgs doesn't use requirements.txt for whatever reason.

(That reason probably being the utter brokenness and braindead state of Python packaging; Node packages work much better.)

2 comments

> Node packages work much better

Are you sure about that? I haven't seen a node app built from source on nixpkgs yet. That includes Electron apps like Signal Desktop, which is a bit disappointing.

There is this article about trying to package jQuery on Guix:

http://dustycloud.org/blog/javascript-packaging-dystopia/

Grep nixpkgs for `buildNpmPackage`, it's ridiculously easy to package a node app nowadays.
Yes, buildNpmPackage works great.
Guix has several different npm importers (none of them merged), but it's debatable whether it is desirable to build npm packages from source when it either creates thousands of barely useful packages.
You can package simple python projects, but as soon as there are too many huge deoendecies that use CPython and whatnot, it becomes impossible to generate the nix derivation. I just use imperative python-venv + pip install on those.
Take a look at Home Assistant to see a complex python app being packaged in Nix.

(disclaimer: it's still rough but it does work)

https://github.com/NixOS/nixpkgs/tree/master/pkgs/servers/ho...

It doesn't, but you need to ditch requirements.txt and just overridePythonPackage with the correct github revision hash.

It's a PITA but unlike pip and conda it's 100% reliable.

> I just use imperative python-venv + pip install on those.

The whole point of NixOS is to manage this and to get rid of those manual steps that are error prone.

I only do this on some work project that I don't touch often, as an escape hatch. Everything else is managed by nix.
Wasn't Nix supposed to solve these problems?
It does. Nix can package everything properly. What is depending on the language ecosystem in question is whether this packaging can be more automized or not.

Python is not trivially automatized with Nix.

And it does, for most languages. Python seems more difficult than average.
Yea python is the exception. Go, rust, nodejs, have been easy to get running with specific versions and dev envs .
...and yet there's tons of Python packaged in traditional distributions including Django.

Nix promises to solve exactly this problem... so it's not clear what the real benefit of Nix is.

EDIT: a rain of silent downvotes?

There's plenty of python packaged in nixpkgs too. It doesn't mean that it isn't a dumpster fire disaster. Dealing with it has been trouble with every other distro I've used. It isn't just a nix problem. If anything I think the situation is improved.
Nix hasn't been a benefit when working with python for me, but again, python is the outlier. It has been a benefit for projects in other languages.

I guess the reason is because python packaging/tooling varies wildly between projects, and there are a lot of bindings.

BTW a colleague was setting up the python project on a non-nix machine, and also had problems with dependencies, and ultimately had to do some nasty workarounds (disabling deps/features). To me, it seems endemic.