Skip to content
Merged
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
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 9 additions & 25 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,30 @@

perSystem =
{ pkgs, ... }:
let
python3 = pkgs.python312;
in
{
packages =
let
python3Packages = pkgs.python312Packages;
python3Packages = python3.pkgs;

pillow-jxl-plugin = python3Packages.callPackage ./nix/package/pillow-jxl-plugin.nix {
inherit (pkgs) cmake;
inherit pyexiv2;
};
pyexiv2 = python3Packages.callPackage ./nix/package/pyexiv2.nix { inherit (pkgs) exiv2; };
vtf2img = python3Packages.callPackage ./nix/package/vtf2img.nix { };
in
rec {
default = tagstudio;
tagstudio = pkgs.callPackage ./nix/package {
# HACK: Remove when PySide6 is bumped to 6.9.x.
# Sourced from https://github.com/NixOS/nixpkgs/commit/2f9c1ad5e19a6154d541f878774a9aacc27381b7.
pyside6 =
if lib.versionAtLeast python3Packages.pyside6.version "6.9.0" then
(python3Packages.pyside6.override {
shiboken6 = python3Packages.shiboken6.overrideAttrs {
version = "6.8.0.2";
inherit python3Packages;

src = pkgs.fetchurl {
url = "mirror://qt/official_releases/QtForPython/shiboken6/PySide6-6.8.0.2-src/pyside-setup-everywhere-src-6.8.0.tar.xz";
hash = "sha256-Ghohmo8yfjQNJYJ1+tOp8mG48EvFcEF0fnPdatJStOE=";
};

sourceRoot = "pyside-setup-everywhere-src-6.8.0/sources/shiboken6";

patches = [ ./nix/package/shiboken6-fix-include-qt-headers.patch ];
};
}).overrideAttrs
{ sourceRoot = "pyside-setup-everywhere-src-6.8.0/sources/pyside6"; }
else
python3Packages.pyside6;

inherit pillow-jxl-plugin vtf2img;
inherit pillow-jxl-plugin;
};
tagstudio-jxl = tagstudio.override { withJXLSupport = true; };

inherit pillow-jxl-plugin pyexiv2 vtf2img;
inherit pillow-jxl-plugin pyexiv2;
};

devShells = rec {
Expand All @@ -79,6 +61,8 @@
lib
pkgs
self

python3
;
};
};
Expand Down
36 changes: 24 additions & 12 deletions nix/package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
pipewire,
python3Packages,
qt6,
ripgrep,
stdenv,
wrapGAppsHook,
wcmatch,

pillow-jxl-plugin,
pyside6,
vtf2img,

withJXLSupport ? false,
}:
Expand All @@ -29,7 +27,7 @@ python3Packages.buildPythonApplication {
python3Packages.pythonRelaxDepsHook
qt6.wrapQtAppsHook

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

makeWrapperArgs =
[ "--prefix PATH : ${lib.makeBinPath [ ffmpeg-headless ]}" ]
++ lib.optional stdenv.hostPlatform.isLinux "--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [ pipewire ]
}";
dontWrapGApps = true;
dontWrapQtApps = true;
makeWrapperArgs = [
"--prefix PATH : ${
lib.makeBinPath [
ffmpeg-headless
ripgrep
]
}"
]
++ lib.optional stdenv.hostPlatform.isLinux "--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [ pipewire ]
}"
++ [
"\${gappsWrapperArgs[@]}"
"\${qtWrapperArgs[@]}"
];

pythonRemoveDeps = lib.optional (!withJXLSupport) [ "pillow_jxl" ];
pythonRelaxDeps = [
"numpy"
"pillow"
"pillow-heif"
"pillow-jxl-plugin"
"pyside6"
"structlog"
"typing-extensions"
];
Expand All @@ -89,15 +100,16 @@ python3Packages.buildPythonApplication {
rawpy
send2trash
sqlalchemy
srctools
structlog
toml
ujson
vtf2img
wcmatch
]
++ lib.optional withJXLSupport pillow-jxl-plugin;

disabledTests = [
# INFO: These tests require modifications to a library, which does not work
# These tests require modifications to a library, which does not work
# in a read-only environment.
"test_build_tag_panel_add_alias_callback"
"test_build_tag_panel_add_aliases"
Expand All @@ -122,7 +134,7 @@ python3Packages.buildPythonApplication {
"test_update_selection_multiple"
"test_update_selection_single"

# INFO: This test requires modification of a configuration file.
# This test requires modification of a configuration file.
"test_filepath_setting"
];

Expand Down
15 changes: 8 additions & 7 deletions nix/package/pillow-jxl-plugin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@

buildPythonPackage rec {
pname = "pillow-jxl-plugin";
version = "1.3.2";
version = "1.3.4";
pyproject = true;

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

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

nativeBuildInputs = [
Expand All @@ -39,9 +39,9 @@ buildPythonPackage rec {
pytestCheckHook
];

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

meta = {
description = "Pillow plugin for JPEG-XL, using Rust for bindings.";
description = "Pillow plugin for JPEG-XL, using Rust for bindings";
homepage = "https://github.com/Isotr0py/pillow-jpegxl-plugin";
changelog = "https://github.com/Isotr0py/pillow-jpegxl-plugin/releases/tag/v${version}";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ xarvex ];
platforms = lib.platforms.unix;
Expand Down
11 changes: 8 additions & 3 deletions nix/package/pyexiv2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
exiv2,
fetchFromGitHub,
lib,
setuptools,
}:

buildPythonPackage rec {
pname = "pyexiv2";
version = "2.15.3";
pyproject = true;

src = fetchFromGitHub {
owner = "LeoHsiao1";
repo = pname;
rev = "v${version}";
repo = "pyexiv2";
tag = "v${version}";
hash = "sha256-83bFMaoXncvhRJNcCgkkC7B29wR5pjuLO/EdkQdqxxo=";
};

Expand All @@ -22,9 +24,12 @@ buildPythonPackage rec {

pythonImportsCheck = [ "pyexiv2" ];

build-system = [ setuptools ];

meta = {
description = "Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile.";
description = "Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile";
homepage = "https://github.com/LeoHsiao1/pyexiv2";
changelog = "https://github.com/LeoHsiao1/pyexiv2/releases/tag/v${version}";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ xarvex ];
platforms = with lib.platforms; darwin ++ linux ++ windows;
Expand Down
81 changes: 0 additions & 81 deletions nix/package/shiboken6-fix-include-qt-headers.patch

This file was deleted.

29 changes: 0 additions & 29 deletions nix/package/vtf2img.nix

This file was deleted.

Loading