Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix picard crash: use consistent qt5 version #99465

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pkgs/applications/audio/picard/default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{ stdenv, python3Packages, fetchFromGitHub, gettext, chromaprint, qt5
{ stdenv, pythonPackages, fetchFromGitHub, gettext, chromaprint, qt5
, enablePlayback ? true
, gst_all_1
}:

let
pythonPackages = python3Packages;
pyqt5 = if enablePlayback then
pythonPackages.pyqt5_with_qtmultimedia
else
Expand Down Expand Up @@ -58,7 +57,7 @@ in pythonPackages.buildPythonApplication rec {
homepage = "https://picard.musicbrainz.org/";
description = "The official MusicBrainz tagger";
maintainers = with maintainers; [ ehmry ];
license = licenses.gpl2;
license = licenses.gpl2Plus;
platforms = platforms.all;
};
}
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22656,7 +22656,7 @@ in

pianobooster = qt5.callPackage ../applications/audio/pianobooster { };

picard = callPackage ../applications/audio/picard { };
picard = python3Packages.callPackage ../applications/audio/picard { };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't use this pattern, it does not compose. If Qt has a set of packages, and Python, which callPackage to use?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So @FRidh you suggest to leave it with callPackage? I kind of like this because this is an elegant way to tell the expression to use whatever qt5 is used by python3Packages.

Copy link
Member Author

@jorsn jorsn Oct 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't use this pattern, it does not compose. If Qt has a set of packages, and Python, which callPackage to use?
@FRidh

Nothing composes here. You have to be explicit in some cases. With my solution, you have to be explicit in less cases.

The question is not resolved by using libsForQt5*.callPackage or callPackage ({ qt5, ... }: ... ). Also, you'd have to find and change every package using python and qt again when python is updated to use qt515, which is not necessary if you use python*Packages.callPackage.

Somehow, you must prioritize which package set chooses the other package sets.
In general it is more likely that python is overriding qt than qt overriding python. So, the only quick and not completely dirty solution I see is exactly this pattern.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So @FRidh you suggest to leave it with callPackage? I kind of like this because this is an elegant way to tell the expression to use whatever qt5 is used by python3Packages.

Always use the callPackage from the set you are in.

Copy link
Member Author

@jorsn jorsn Oct 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Why not define python applications in pythonPackages then?

Copy link
Member Author

@jorsn jorsn Oct 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the callPackage of a sub-scope is officially recommended by the nixpkgs manual:

Adding an application to Nixpkgs. Add a Qt application to all-packages.nix using libsForQt5.callPackage instead of the usual callPackage. The former ensures that all dependencies are built with the same version of Qt.
https://nixos.org/manual/nixpkgs/stable/#sec-language-qt

Edit: One could even say: For an interpreted program, always use the callPackages from the scope of your interpreter, which should provide consistent dependencies (otherwise it's a bug).

Copy link
Member Author

@jorsn jorsn Oct 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'd have to find and change every package using python and qt again when python is updated to use qt515, which is not necessary if you use python*Packages.callPackage

Is this a pracitcal scenario? All the packages will build successfully but produce runtime errors!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always use the callPackage from the set you are in.

@FRidh I'm afraid that's a hard requirement to comply to. To my view it contradicts a different requirements that you (pythonPackages' maintainers) also have - which is "don't put python applications in pkgs/top-level/python-modules/ and pkgs/top-level/python-packages.nix".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Applications are in top-level, libraries in python-packages.nix. Libraries have Python packages as parameters, applications do not. The messy part is when a package is to be used as both, in which case library usage takes precedence, and one uses foo = with python3Packages; toPythonApplication mypackage;.


picocom = callPackage ../tools/misc/picocom {
inherit (darwin.apple_sdk.frameworks) IOKit;
Expand Down