Open l0b0 opened 2 years ago
The above override actually works for me if I use a recent nixpkgs snapshot that has usable hatchling
and hatch-vcs
Python packages.
Another option is to add the required modules to pyproject.toml
(e.g., to the [tool.poetry.dev-dependencies]
section), then poetry2nix would use the module versions specified there instead of taking whatever is in nixpkgs (and would also pick up any dependencies like that pluggy
module). However, you may run into version conflicts with other modules; e.g., this is what I ended up with at the moment:
# These dependencies are required by the jsonschema >= 4.6.0 build system, but
# are not detected automatically; they are also not present in the used Nixpkgs
# snapshot, so need to be obtained through Poetry.
hatchling = "*"
hatch-vcs = "*"
# The `pytest` module in the used Nixpkgs snapshot has an upper bound on the
# `pluggy` dependency, which conflicts with the dependency of the `hatchling`
# module; upgrading the `pytest` module fixes the conflict.
pytest = "*"
# Building the `tomli` module, which is in the dependency tree of `hatchling`,
# requires a newer `flit-core` module than found in the used Nixpkgs snapshot.
flit-core = "*"
I suppose that the PR to add the override for jsonschema
would need to use if (lib.versionAtLeast super.jsonschema.version "4.6.0")
to keep older module versions working as before.
@sigprof I get the same error message when using both the 22.05 stable nixpkgs and today's version:
{ pkgs ? import
(
fetchTarball
{
name = "nixpkgs-22.05-2022-06-13";
url = "https://github.com/NixOS/nixpkgs/archive/37b6b161e536fddca54424cf80662bce735bdd1e.tar.gz";
sha256 = "1zwv5qcz5pnyj1ya7ia6rd5d9i0l40pc8av6blf0065hwd1nh7p1";
})
{ }
}:
[…]
jsonschema = super.jsonschema.overridePythonAttrs (
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
self.hatchling
self.hatch-vcs
];
}
);
[…]
Could you please post your full shell.nix if you got this to work?
In any case, the underlying question is different: How do I set up a build system override in mkPoetryEnv
?
@l0b0 The exact version of the code which works for me is https://github.com/sigprof/nix-devenv-qmk/tree/e9ae48fb368951d3eaa13f2d0d837fc803934557 (beware that it is pinned on a rather old version of nixpkgs and stays on it for now to avoid causing a rebuild of pkgsCross.avr.buildPackages.gcc8
for its users; you can set avr
to false
to avoid the need to compile that part). Although I also tried to switch nixpkgs
to a recent snapshot — in that case the override worked too even without the pyproject.toml
change and the corresponding poetry.lock
update.
Note that self.hatchling
inside the override is actually affected by the content of poetry.lock
, so your problem may be actually caused by some conflicts in the package set that you are trying to build, and you may actually need to make some adjustments to your pyproject.toml
because of that.
As for the general question of setting up a build system override, from looking at how addBuildSystem
is defined and how it is then used when processing build-systems.json
it looks like the only thing that your replacement definition is missing is the check for old ? format && old.format == "wheel"
, which does not seem to be important in this particular case (apparently Poetry wants to rebuild the package instead of using a wheel).
Describe the issue
As a relative Nix newbie it's not obvious how to create a new override to emulate
addBuildSystem
(I'm trying to avoid changingbuild-systems.json
itself, if that makes sense). For example, jsonschema 4.6.0 seems to require hatchling, but the overridejust results in a different error:
Does this error require a different override, or did I do something wrong with my hatchling override?