Conflict between extraPackages and overrides
Opened this issue · 0 comments
jonathan-conder commented
Describe the issue
I'm attempting to add python-lsp-ruff
to extraPackages
, but I get this error:
error: attribute 'ruff' missing
at /nix/store/lpqygnph8c5l7ajkmqr4rff0pvkfz1f6-source/overrides/default.nix:3229:9:
3228| in
3229| prev.ruff.overridePythonAttrs (old:
| ^
3230| let
Did you mean one of cruft, daff, ruffus, runs or tuf?
The issue seems to be that ruff
isn't in python3Packages
, but the overlay assumes it is. Usually an earlier overlay will add it, from poetry.lock
.
I found a workaround which I've left commented out below. If it suits I can make a PR to remove ruff
from the overlay if prev.ruff
doesn't exist. Or maybe the overlay shouldn't be applied to extraPackages
? An alternative would be add ruff
to python3Packages
in nixpkgs.
Additional context
flake.nix
:
{
description = "MWE";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
outputs = {
self,
nixpkgs,
poetry2nix,
}: let
toPackages = _: pkgs: let
poetryLib = poetry2nix.lib.mkPoetry2Nix {inherit pkgs;};
# overlay = final: prev: {inherit (pkgs) ruff;};
in {
default = poetryLib.mkPoetryEnv {
projectDir = self;
extraPackages = ps: [ps.python-lsp-ruff];
# overrides = poetryLib.defaultPoetryOverrides.overrideOverlay overlay;
};
};
in {
packages = builtins.mapAttrs toPackages nixpkgs.legacyPackages;
};
}
pyproject.toml
:
[tool.poetry]
name = "mwe"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
poetry.lock
:
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
package = []
[metadata]
lock-version = "2.0"
python-versions = "^3.11"
content-hash = "81b2fa642d7f2d1219cf80112ace12d689d053d81be7f7addb98144d56fc0fb2"