Skip to content

Commit 899c534

Browse files
authored
fix(nix): fixup and rework, always use nixpkgs PySide/Qt (#1048)
1 parent 74383e3 commit 899c534

File tree

8 files changed

+115
-198
lines changed

8 files changed

+115
-198
lines changed

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,48 +27,30 @@
2727

2828
perSystem =
2929
{ pkgs, ... }:
30+
let
31+
python3 = pkgs.python312;
32+
in
3033
{
3134
packages =
3235
let
33-
python3Packages = pkgs.python312Packages;
36+
python3Packages = python3.pkgs;
3437

3538
pillow-jxl-plugin = python3Packages.callPackage ./nix/package/pillow-jxl-plugin.nix {
3639
inherit (pkgs) cmake;
3740
inherit pyexiv2;
3841
};
3942
pyexiv2 = python3Packages.callPackage ./nix/package/pyexiv2.nix { inherit (pkgs) exiv2; };
40-
vtf2img = python3Packages.callPackage ./nix/package/vtf2img.nix { };
4143
in
4244
rec {
4345
default = tagstudio;
4446
tagstudio = pkgs.callPackage ./nix/package {
45-
# HACK: Remove when PySide6 is bumped to 6.9.x.
46-
# Sourced from https://github.com/NixOS/nixpkgs/commit/2f9c1ad5e19a6154d541f878774a9aacc27381b7.
47-
pyside6 =
48-
if lib.versionAtLeast python3Packages.pyside6.version "6.9.0" then
49-
(python3Packages.pyside6.override {
50-
shiboken6 = python3Packages.shiboken6.overrideAttrs {
51-
version = "6.8.0.2";
47+
inherit python3Packages;
5248

53-
src = pkgs.fetchurl {
54-
url = "mirror://qt/official_releases/QtForPython/shiboken6/PySide6-6.8.0.2-src/pyside-setup-everywhere-src-6.8.0.tar.xz";
55-
hash = "sha256-Ghohmo8yfjQNJYJ1+tOp8mG48EvFcEF0fnPdatJStOE=";
56-
};
57-
58-
sourceRoot = "pyside-setup-everywhere-src-6.8.0/sources/shiboken6";
59-
60-
patches = [ ./nix/package/shiboken6-fix-include-qt-headers.patch ];
61-
};
62-
}).overrideAttrs
63-
{ sourceRoot = "pyside-setup-everywhere-src-6.8.0/sources/pyside6"; }
64-
else
65-
python3Packages.pyside6;
66-
67-
inherit pillow-jxl-plugin vtf2img;
49+
inherit pillow-jxl-plugin;
6850
};
6951
tagstudio-jxl = tagstudio.override { withJXLSupport = true; };
7052

71-
inherit pillow-jxl-plugin pyexiv2 vtf2img;
53+
inherit pillow-jxl-plugin pyexiv2;
7254
};
7355

7456
devShells = rec {
@@ -79,6 +61,8 @@
7961
lib
8062
pkgs
8163
self
64+
65+
python3
8266
;
8367
};
8468
};

nix/package/default.nix

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
pipewire,
55
python3Packages,
66
qt6,
7+
ripgrep,
78
stdenv,
89
wrapGAppsHook,
9-
wcmatch,
1010

1111
pillow-jxl-plugin,
12-
pyside6,
13-
vtf2img,
1412

1513
withJXLSupport ? false,
1614
}:
@@ -29,7 +27,7 @@ python3Packages.buildPythonApplication {
2927
python3Packages.pythonRelaxDepsHook
3028
qt6.wrapQtAppsHook
3129

32-
# INFO: Should be unnecessary once PR is pulled.
30+
# Should be unnecessary once PR is pulled.
3331
# PR: https://github.com/NixOS/nixpkgs/pull/271037
3432
# Issue: https://github.com/NixOS/nixpkgs/issues/149812
3533
wrapGAppsHook
@@ -54,18 +52,31 @@ python3Packages.buildPythonApplication {
5452
cp $src/src/tagstudio/resources/icon.png $out/share/icons/hicolor/512x512/apps/tagstudio.png
5553
'';
5654

57-
makeWrapperArgs =
58-
[ "--prefix PATH : ${lib.makeBinPath [ ffmpeg-headless ]}" ]
59-
++ lib.optional stdenv.hostPlatform.isLinux "--prefix LD_LIBRARY_PATH : ${
60-
lib.makeLibraryPath [ pipewire ]
61-
}";
55+
dontWrapGApps = true;
56+
dontWrapQtApps = true;
57+
makeWrapperArgs = [
58+
"--prefix PATH : ${
59+
lib.makeBinPath [
60+
ffmpeg-headless
61+
ripgrep
62+
]
63+
}"
64+
]
65+
++ lib.optional stdenv.hostPlatform.isLinux "--prefix LD_LIBRARY_PATH : ${
66+
lib.makeLibraryPath [ pipewire ]
67+
}"
68+
++ [
69+
"\${gappsWrapperArgs[@]}"
70+
"\${qtWrapperArgs[@]}"
71+
];
6272

6373
pythonRemoveDeps = lib.optional (!withJXLSupport) [ "pillow_jxl" ];
6474
pythonRelaxDeps = [
6575
"numpy"
6676
"pillow"
6777
"pillow-heif"
6878
"pillow-jxl-plugin"
79+
"pyside6"
6980
"structlog"
7081
"typing-extensions"
7182
];
@@ -89,15 +100,16 @@ python3Packages.buildPythonApplication {
89100
rawpy
90101
send2trash
91102
sqlalchemy
103+
srctools
92104
structlog
93105
toml
94106
ujson
95-
vtf2img
107+
wcmatch
96108
]
97109
++ lib.optional withJXLSupport pillow-jxl-plugin;
98110

99111
disabledTests = [
100-
# INFO: These tests require modifications to a library, which does not work
112+
# These tests require modifications to a library, which does not work
101113
# in a read-only environment.
102114
"test_build_tag_panel_add_alias_callback"
103115
"test_build_tag_panel_add_aliases"
@@ -122,7 +134,7 @@ python3Packages.buildPythonApplication {
122134
"test_update_selection_multiple"
123135
"test_update_selection_single"
124136

125-
# INFO: This test requires modification of a configuration file.
137+
# This test requires modification of a configuration file.
126138
"test_filepath_setting"
127139
];
128140

nix/package/pillow-jxl-plugin.nix

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313

1414
buildPythonPackage rec {
1515
pname = "pillow-jxl-plugin";
16-
version = "1.3.2";
16+
version = "1.3.4";
1717
pyproject = true;
1818

1919
src = fetchPypi {
20-
pname = builtins.replaceStrings [ "-" ] [ "_" ] pname;
20+
pname = "pillow_jxl_plugin";
2121
inherit version;
22-
hash = "sha256-efBoek8yUFR+ArhS55lm9F2XhkZ7/I3GsScQEe8U/2I=";
22+
hash = "sha256-jqWJ/FWep8XfzLQq9NgUj121CPX01FGDKLq1ox/LJo4=";
2323
};
2424

2525
cargoDeps = rustPlatform.fetchCargoVendor {
2626
inherit src;
27-
hash = "sha256-vZHrwGfgo3fIIOY7p0vy4XIKiHoddPDdJggkBen+w/A=";
27+
hash = "sha256-7j+sCn+P6q6tsm2MJ/cM7hF2KEjILJNA6SDb35tecPg=";
2828
};
2929

3030
nativeBuildInputs = [
@@ -39,9 +39,9 @@ buildPythonPackage rec {
3939
pytestCheckHook
4040
];
4141

42-
# INFO: Working directory takes precedence in the Python path. Remove
42+
# Working directory takes precedence in the Python path. Remove
4343
# `pillow_jxl` to prevent it from being loaded during pytest, rather than the
44-
# built module, as it includes a `pillow_jxl.pillow_jxl` .so that is imported.
44+
# built module, as it includes a `pillow_jxl.pillow_jxl.so` that is imported.
4545
# See: https://github.com/NixOS/nixpkgs/issues/255262
4646
# See: https://github.com/NixOS/nixpkgs/pull/255471
4747
preCheck = ''
@@ -58,8 +58,9 @@ buildPythonPackage rec {
5858
];
5959

6060
meta = {
61-
description = "Pillow plugin for JPEG-XL, using Rust for bindings.";
61+
description = "Pillow plugin for JPEG-XL, using Rust for bindings";
6262
homepage = "https://github.com/Isotr0py/pillow-jpegxl-plugin";
63+
changelog = "https://github.com/Isotr0py/pillow-jpegxl-plugin/releases/tag/v${version}";
6364
license = lib.licenses.gpl3;
6465
maintainers = with lib.maintainers; [ xarvex ];
6566
platforms = lib.platforms.unix;

nix/package/pyexiv2.nix

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44
exiv2,
55
fetchFromGitHub,
66
lib,
7+
setuptools,
78
}:
89

910
buildPythonPackage rec {
1011
pname = "pyexiv2";
1112
version = "2.15.3";
13+
pyproject = true;
1214

1315
src = fetchFromGitHub {
1416
owner = "LeoHsiao1";
15-
repo = pname;
16-
rev = "v${version}";
17+
repo = "pyexiv2";
18+
tag = "v${version}";
1719
hash = "sha256-83bFMaoXncvhRJNcCgkkC7B29wR5pjuLO/EdkQdqxxo=";
1820
};
1921

@@ -22,9 +24,12 @@ buildPythonPackage rec {
2224

2325
pythonImportsCheck = [ "pyexiv2" ];
2426

27+
build-system = [ setuptools ];
28+
2529
meta = {
26-
description = "Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile.";
30+
description = "Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile";
2731
homepage = "https://github.com/LeoHsiao1/pyexiv2";
32+
changelog = "https://github.com/LeoHsiao1/pyexiv2/releases/tag/v${version}";
2833
license = lib.licenses.gpl3;
2934
maintainers = with lib.maintainers; [ xarvex ];
3035
platforms = with lib.platforms; darwin ++ linux ++ windows;

nix/package/shiboken6-fix-include-qt-headers.patch

Lines changed: 0 additions & 81 deletions
This file was deleted.

nix/package/vtf2img.nix

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)