From 8269f796304bcadb5744bdbca4ff585a47f38841 Mon Sep 17 00:00:00 2001 From: Aliaksandr Date: Wed, 31 Dec 2025 16:38:13 +0200 Subject: [PATCH] alice-tools-*: modernize --- pkgs/by-name/al/alice-tools/package.nix | 30 +++++++++++++++---------- pkgs/top-level/all-packages.nix | 9 ++------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/pkgs/by-name/al/alice-tools/package.nix b/pkgs/by-name/al/alice-tools/package.nix index b70300a65871..fde4fed78d90 100644 --- a/pkgs/by-name/al/alice-tools/package.nix +++ b/pkgs/by-name/al/alice-tools/package.nix @@ -1,6 +1,6 @@ { - stdenv, lib, + stdenv, gitUpdater, testers, fetchFromGitHub, @@ -14,35 +14,40 @@ libjpeg, libwebp, zlib, - withGUI ? true, - qtbase ? null, - wrapQtAppsHook ? null, + withQt5 ? false, + qt5, + withQt6 ? false, + qt6, }: -assert withGUI -> qtbase != null && wrapQtAppsHook != null; +assert !(withQt5 && withQt6); +let + qt = if withQt5 then qt5 else qt6; + withGUI = withQt5 || withQt6; +in stdenv.mkDerivation (finalAttrs: { - pname = "alice-tools" + lib.optionalString withGUI "-qt${lib.versions.major qtbase.version}"; + pname = "alice-tools" + lib.optionalString withGUI "-qt${lib.versions.major qt.qtbase.version}"; version = "0.13.0"; src = fetchFromGitHub { owner = "nunuhara"; repo = "alice-tools"; - rev = finalAttrs.version; + tag = finalAttrs.version; fetchSubmodules = true; hash = "sha256-DazWnBeI5XShkIx41GFZLP3BbE0O8T9uflvKIZUXCHo="; }; - postPatch = lib.optionalString (withGUI && lib.versionAtLeast qtbase.version "6.0") '' + postPatch = lib.optionalString (withGUI && withQt6) '' # Use Meson's Qt6 module substituteInPlace src/meson.build \ --replace qt5 qt6 # For some reason Meson uses QMake instead of pkg-config detection method for Qt6 on Darwin, which gives wrong search paths for tools - export PATH=${qtbase.dev}/libexec:$PATH + export PATH=${qt.qtbase.dev}/libexec:$PATH ''; - mesonFlags = lib.optionals (withGUI && lib.versionAtLeast qtbase.version "6.0") [ + mesonFlags = lib.optionals (withGUI && withQt6) [ # Qt6 requires at least C++17, project uses compiler's default, default too old on Darwin & aarch64-linux "-Dcpp_std=c++17" ]; @@ -55,7 +60,7 @@ stdenv.mkDerivation (finalAttrs: { flex ] ++ lib.optionals withGUI [ - wrapQtAppsHook + qt.wrapQtAppsHook ]; buildInputs = [ @@ -66,7 +71,7 @@ stdenv.mkDerivation (finalAttrs: { zlib ] ++ lib.optionals withGUI [ - qtbase + qt.qtbase ]; dontWrapQtApps = true; @@ -102,6 +107,7 @@ stdenv.mkDerivation (finalAttrs: { license = lib.licenses.gpl2Plus; platforms = lib.platforms.all; maintainers = with lib.maintainers; [ OPNA2608 ]; + changelog = "https://github.com/nunuhara/alice-tools/releases/tag/${finalAttrs.src.tag}"; mainProgram = if withGUI then "galice" else "alice"; }; }) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ed09a65de2a4..e09bafe20c79 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -988,13 +988,8 @@ with pkgs; akkuPackages ; - alice-tools = callPackage ../by-name/al/alice-tools/package.nix { - withGUI = false; - }; - - alice-tools-qt5 = libsForQt5.callPackage ../by-name/al/alice-tools/package.nix { }; - - alice-tools-qt6 = qt6Packages.callPackage ../by-name/al/alice-tools/package.nix { }; + alice-tools-qt5 = alice-tools.override { withQt5 = true; }; + alice-tools-qt6 = alice-tools.override { withQt6 = true; }; auditwheel = with python3Packages; toPythonApplication auditwheel;