about summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2024-04-01 17:17:07 +0200
committerPeter Hoeg <peter@hoeg.com>2024-04-10 05:59:22 -0700
commitc392dd79976fdcc7cd4617514463c12d29b5a708 (patch)
tree9097dfcc5f584b3dab933ef5e50422d0f58d0eed /pkgs/applications
parent250855f6b660228190bb522b2e0dbc6667870fda (diff)
kid3: build with qt6 and KDE support
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/audio/kid3/default.nix53
1 files changed, 39 insertions, 14 deletions
diff --git a/pkgs/applications/audio/kid3/default.nix b/pkgs/applications/audio/kid3/default.nix
index 1aa79a69e5239..cae02e03e613c 100644
--- a/pkgs/applications/audio/kid3/default.nix
+++ b/pkgs/applications/audio/kid3/default.nix
@@ -1,5 +1,4 @@
-{
-  chromaprint
+{ chromaprint
 , cmake
 , docbook_xml_dtd_45
 , docbook_xsl
@@ -7,25 +6,43 @@
 , ffmpeg
 , flac
 , id3lib
+, kdePackages
 , lib
 , libogg
 , libvorbis
 , libxslt
 , mp4v2
-, phonon
 , pkg-config
 , python3
 , qtbase
+, qtdeclarative
 , qtmultimedia
-, qtquickcontrols
 , qttools
 , readline
 , stdenv
 , taglib
 , wrapQtAppsHook
 , zlib
+, withCLI ? true
+, withKDE ? true
+, withQt ? false
 }:
 
+let
+  inherit (lib) optionals;
+
+  apps = lib.concatStringsSep ";" (
+    optionals withCLI [ "CLI" ]
+    ++ optionals withKDE [ "KDE" ]
+    ++ optionals withQt [ "Qt" ]
+  );
+
+  mainProgram =
+    if withQt then "kid3-qt"
+    else if withKDE then "kid3"
+    else "kid3-cli";
+
+in
 stdenv.mkDerivation (finalAttrs: {
   pname = "kid3";
   version = "3.9.5";
@@ -41,6 +58,7 @@ stdenv.mkDerivation (finalAttrs: {
     docbook_xsl
     pkg-config
     python3
+    qttools
     wrapQtAppsHook
   ];
 
@@ -53,25 +71,32 @@ stdenv.mkDerivation (finalAttrs: {
     libvorbis
     libxslt
     mp4v2
-    phonon
     qtbase
+    qtdeclarative
     qtmultimedia
-    qtquickcontrols
-    qttools
     readline
     taglib
     zlib
-  ];
+  ] ++ lib.optionals withKDE (with kdePackages; [
+    kconfig
+    kconfigwidgets
+    kcoreaddons
+    kio
+    kxmlgui
+    phonon
+  ]);
 
-  cmakeFlags = [ "-DWITH_APPS=Qt;CLI" ];
-  NIX_LDFLAGS = "-lm -lpthread";
+  cmakeFlags = [ (lib.cmakeFeature "WITH_APPS" apps) ];
 
-  preConfigure = ''
-    export DOCBOOKDIR="${docbook_xsl}/xml/xsl/docbook/"
-  '';
+  env = {
+    DOCBOOKDIR = "${docbook_xsl}/xml/xsl/docbook/";
+    LANG = "C.UTF-8";
+    NIX_LDFLAGS = "-lm -lpthread";
+  };
 
   meta = {
     description = "A simple and powerful audio tag editor";
+    inherit mainProgram;
     homepage = "https://kid3.kde.org/";
     license = lib.licenses.lgpl2Plus;
     longDescription = ''
@@ -103,7 +128,7 @@ stdenv.mkDerivation (finalAttrs: {
       - Edit synchronized lyrics and event timing codes, import and export
         LRC files.
     '';
-    maintainers = [ lib.maintainers.AndersonTorres ];
+    maintainers = with lib.maintainers; [ AndersonTorres ];
     platforms = lib.platforms.linux;
   };
 })