You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question: How can one use the passthru in the overrides? #514
changed the title [-]Question: How can one use passthru in the overrides?[/-][+]Question: How can one use the passthru in the overrides?[/+]on Jan 18, 2022
I got the impression that the flags enableTk and enableQt load the necessary packages with these lines.
At the moment, enableTk and enableQt have no effect. Qt works if and only if I pass pkgs.qt5.full to buildInputs and Tk only works if I pass pkgs.python3Full to buildInputs.
What is the purpose then of enableTk and enableQt ?
My hypothesis is that when using pkgs.poetry2nix.overrides.withDefaults, if the python package you want to override is either in the file overrides/default.nix or overrides/build-systems.json, you cannot override with the method that @adisbladis showed as follows.
This isn't at all obvious, but passthru.args is set to whatever is passed to the function that creates the derivation.
Matplotlib didn't look at passthru.args, but instead looked at passthru. This should be fixed in #516.
With this change you should be able to create an override looking something like:
That said, the above method works with pkgs.poetry2nix.overrides.withoutDefaults and works with packages like pyro-ppl that are neither in overrides/default.nix nor overrides/build-systems.json.
I've also tested the above hypothesis with matplotlib which is only in overrides/default.nix. After commenting out matplotlib part in overrides/default.nix, matplotlib has passthru.args with correct values!
super.matplotlib.overridePythonAttrs didn't work for me, though I'm using a flake. The derivation's attribute does change, but it doesn't affect matplotlib's buildInputs. super.matplotlib.override does work.
There's separate error when using enableTk; The pkgs.libX11 input isn't found. I'm guessing because it's a spliced package, and for some reason the spliced top-level packages aren't in the pkgs that's being evaluated.
Activity
[-]Question: How to use passthru in the overrides.[/-][+]Question: How can one use passthru in the overrides?[/+][-]Question: How can one use passthru in the overrides?[/-][+]Question: How can one use the passthru in the overrides?[/+]adisbladis commentedon Jan 18, 2022
This isn't at all obvious, but
passthru.argsis set to whatever is passed to the function that creates the derivation.Matplotlib didn't look at
passthru.args, but instead looked atpassthru.This should be fixed in #516.
With this change you should be able to create an override looking something like:
vale981 commentedon Jan 20, 2022
thank you very much for the hint.
I'll try it out :)
mschneiderwng commentedon Jan 23, 2022
How is this applied? I tried
and get the error
adisbladis commentedon Jan 23, 2022
That does indicate that it is working, but you would also need to pass
python3FulltomkPoetryEnvas the default python build doesn't enable tk.mschneiderwng commentedon Jan 24, 2022
I got the impression that the flags
enableTkandenableQtload the necessary packages with these lines.At the moment,
enableTkandenableQthave no effect. Qt works if and only if I passpkgs.qt5.fulltobuildInputsand Tk only works if I passpkgs.python3FulltobuildInputs.What is the purpose then of
enableTkandenableQt?sepiabrown commentedon Apr 10, 2022
Changing the below code in
overrides/default.nixinto
makes the
nix replmoan the following.error: attribute 'enableGhostscript' missingshell.nix
``` { pkgs ? import ../nixpkgs {} }: let myAppEnv = pkgs.poetry2nix.mkPoetryEnv { projectDir = ./.; python = pkgs.python3Full; overrides = pkgs.poetry2nix.overrides.withDefaults (final: prev: { matplotlib = prev.matplotlib.override { enableGhostscript = true; }; }); }; in {inherit myAppEnv pkgs;} ```pyproject.toml
``` [tool.poetry] name = "my-python-package" version = "0.1.0" description = "" authors = ["Suwon Park "][tool.poetry.dependencies]
python = "3.9.10"
matplotlib = "^3.5.1"
kiwisolver = "<=1.3.2"
cppy = "<=1.1.0"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
sepiabrown commentedon Apr 10, 2022
My hypothesis is that when using
pkgs.poetry2nix.overrides.withDefaults, if the python package you want to override is either in the fileoverrides/default.nixoroverrides/build-systems.json, you cannot override with the method that @adisbladis showed as follows.That said, the above method works with
pkgs.poetry2nix.overrides.withoutDefaultsand works with packages likepyro-pplthat are neither inoverrides/default.nixnoroverrides/build-systems.json.I've also tested the above hypothesis with
matplotlibwhich is only inoverrides/default.nix. After commenting outmatplotlibpart inoverrides/default.nix,matplotlibhaspassthru.argswith correct values!shell.nix
``` sepiabrown@localhost:~/testtesttest$ cat shell.nix { pkgs ? import ../nixpkgs {} }: let myAppEnv = pkgs.poetry2nix.mkPoetryEnv { projectDir = ./.; overrides = pkgs.poetry2nix.overrides.withDefaults (final: prev: { peewee = prev.peewee.override { withPostgres = true; test_peewee = "peewee"; }; pyro-ppl = prev.pyro-ppl.override { test_pyro = "pyro"; }; tomli = prev.tomli.override { test_tomli = "tomli"; }; emoji = prev.emoji.override { test_emoji = "emoji"; }; matplotlib = prev.matplotlib.override { enableGhostscript = true; test_mat = "mat"; }; }); }; in {inherit myAppEnv pkgs;} # myAppEnv.env ```pyproject.toml
``` [tool.poetry] name = "my-python-package" version = "0.1.0" description = "" authors = ["Suwon Park "][tool.poetry.dependencies]
python = "3.9.10"
numpy = "^1.22.3"
pyro-ppl = "^1.8.1"
peewee = "^3.14.10"
tomli = "^2.0.1"
emoji = "^1.7.0"
matplotlib = "^3.5.1"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
AlexChalk commentedon Jul 5, 2023
This works for me:
jicksaw commentedon Mar 28, 2024
super.matplotlib.overridePythonAttrsdidn't work for me, though I'm using a flake. The derivation's attribute does change, but it doesn't affectmatplotlib's buildInputs.super.matplotlib.overridedoes work.There's separate error when using
enableTk; Thepkgs.libX11input isn't found. I'm guessing because it's a spliced package, and for some reason the spliced top-level packages aren't in thepkgsthat's being evaluated.poetry2nix/overrides/default.nix
Line 1481 in 3c92540
Here's the poetry2nix flake template modified to use Qt instead:
vale981 commentedon May 13, 2024
I totally forgot that I ever opened that issue and recently "re-discovered" the solution.
For me, the original tip by @adisbladis works in a flake.
For me this resolves the issue!