NixOS notes
Overriding a Python package version using a Nixpkgs overlay
Python 3.12 requires a newer version of Babel than is packaged in the NixOS 23.11 channel. It can be overridden using the following overlay.
let
fixBabel = (self: super: {
python312 = super.python312.override {
packageOverrides = python-self: python-super: {
babel = python-super.babel.overridePythonAttrs (oldAttrs: rec {
version = "2.14.0";
src = super.fetchPypi {
pname = "Babel";
inherit version;
hash = "sha256-aRmGfbA2OYuiHrXHoPayirjLw656c6ROvjSudKTn02M=";
};
});
};
};
});which can then be applied to nixpkgs using
pkgs = nixpkgs.legacyPackages.${system}.extend fixBabel;or similar.
Missing pyproject.toml when using poetry2nix
Poetry2nix by default removes all files in .gitignore from the source directory when building a Python package. Check whether *.toml or similar is in your .gitignore; this might be the case if you use TOML for files you don't want to commit, e.g. config files.