README.md: be more specific withDefaults application order#1877
README.md: be more specific withDefaults application order#1877spinus wants to merge 1 commit intonix-community:masterfrom
Conversation
|
In relation to #1519 |
Nebucatnetzer
left a comment
There was a problem hiding this comment.
In general it looks good, some minor things and a few typos.
| - [mkPoetryEditablePackage](#mkpoetryeditablepackage): Creates a package containing editable sources. Changes in the specified paths will be reflected in an interactive nix-shell session without the need to restart it. | ||
| - [defaultPoetryOverrides](#defaultpoetryoverrides): A set of bundled overrides fixing problems with Python packages. | ||
| - [overrides.withDefaults](#overrideswithdefaults): A convenience function for specifying overrides on top of the defaults. | ||
| - [overrides.withDefaults](#overrideswithdefaults): A convenience function for specifying overrides on top of the defaults (it applies user overrides and then applies defaults after). |
There was a problem hiding this comment.
"it applies user overrides first and then applies defaults"
| } | ||
| ``` | ||
|
|
||
| Please remember that `withDefaults` function, applies user overrides first, and than applies `defaults`. If you want to change package |
There was a problem hiding this comment.
Please remember that the
withDefaultsfunction
Missing the
and then
Then instead of than.
If you want to change a package
Missing a.
| ``` | ||
|
|
||
| Please remember that `withDefaults` function, applies user overrides first, and than applies `defaults`. If you want to change package | ||
| that already is overriden by `defaults` you may need to do |
There was a problem hiding this comment.
Can you rewrite it like this?
The text and the code are separated by an empty line.
you can use the a snippet like the following which then puts your changes on top of the defaults: ```nix
|
@elikoga Can you explain to me the difference between the code snippet in this merge request and the way it is done here? jwpconsulting/projectify@5aef755 |
I believe it's just like justuswilhelm said in #1519 :
where Compared to |
|
The real problem is that some overrides work only when applied before overrides = [
# Some overrides (e.g., the ones which set preferWheel) must be applied
# before the default overrides:
# https://github.com/nix-community/poetry2nix/pull/899
(self: super: {
attrs = super.attrs.override {
# attrs >= 24.3.0 requires hatchling >= 1.26.0 to build from source:
# https://github.com/python-attrs/attrs/pull/1377
# https://github.com/pypa/hatch/issues/1715
preferWheel = true;
};
})
poetry2nix.defaultPoetryOverrides
# Apply most overrides after the default overrides, so that things like
# overriding cargoDeps work even when the default overrides also do that:
# https://github.com/nix-community/poetry2nix/issues/1519
(self: super: {
rpds-py = let
getCargoHash = version: {
"0.22.3" = "sha256-m01OB4CqDowlTAiDQx6tJ7SeP3t+EtS9UZ7Jad6Ccvc=";
}.${version} or (
lib.warn "Unknown rpds-py version: '${version}'. Please update getCargoHash." lib.fakeHash
);
in
super.rpds-py.overridePythonAttrs(old: {
cargoDeps = pkgs.rustPlatform.fetchCargoTarball {
inherit (old) src;
name = "${old.pname}-${old.version}";
hash = getCargoHash old.version;
};
});
});
})
]; |
|
From #899
Since we already have poetry2nix.defaultPoetryOverrides why not deprecate the old function with a warning, then later removal or similar (in 2 nixos release cycles?) If the api of the function can be changed to break for some users anyways, why not for all users? |
Contribution checklist (recommended but not always applicable/required):