From a6d9f8ac19c5e4d9aeefa67a43c6f147d3aab575 Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Wed, 6 Nov 2024 18:10:28 +0800 Subject: [PATCH 1/4] cantata: move to by-name --- .../cantata/dont-check-for-perl-in-PATH.diff | 0 .../ca/cantata/package.nix} | 17 +++++++---------- pkgs/top-level/all-packages.nix | 2 -- 3 files changed, 7 insertions(+), 12 deletions(-) rename pkgs/{applications/audio => by-name/ca}/cantata/dont-check-for-perl-in-PATH.diff (100%) rename pkgs/{applications/audio/cantata/default.nix => by-name/ca/cantata/package.nix} (95%) diff --git a/pkgs/applications/audio/cantata/dont-check-for-perl-in-PATH.diff b/pkgs/by-name/ca/cantata/dont-check-for-perl-in-PATH.diff similarity index 100% rename from pkgs/applications/audio/cantata/dont-check-for-perl-in-PATH.diff rename to pkgs/by-name/ca/cantata/dont-check-for-perl-in-PATH.diff diff --git a/pkgs/applications/audio/cantata/default.nix b/pkgs/by-name/ca/cantata/package.nix similarity index 95% rename from pkgs/applications/audio/cantata/default.nix rename to pkgs/by-name/ca/cantata/package.nix index a9ce19cfdb81..27acc7d2a5cb 100644 --- a/pkgs/applications/audio/cantata/default.nix +++ b/pkgs/by-name/ca/cantata/package.nix @@ -1,11 +1,9 @@ -{ mkDerivation +{ stdenv , lib , fetchFromGitHub , cmake , pkg-config -, qtbase -, qtsvg -, qttools +, qt6 , perl # Cantata doesn't build with cdparanoia enabled so we disable that @@ -23,7 +21,6 @@ , taglib , taglib_extras , withHttpStream ? true -, qtmultimedia , withReplaygain ? true , ffmpeg , speex @@ -64,7 +61,7 @@ let { names = [ "FFMPEG" "MPG123" "SPEEXDSP" ]; enable = withReplaygain; pkgs = [ ffmpeg speex mpg123 ]; } { names = [ "HTTPS_SUPPORT" ]; enable = true; pkgs = [ ]; } { names = [ "HTTP_SERVER" ]; enable = withHttpServer; pkgs = [ ]; } - { names = [ "HTTP_STREAM_PLAYBACK" ]; enable = withHttpStream; pkgs = [ qtmultimedia ]; } + { names = [ "HTTP_STREAM_PLAYBACK" ]; enable = withHttpStream; pkgs = [ qt6.qtmultimedia ]; } { names = [ "LAME" ]; enable = withLame; pkgs = [ lame ]; } { names = [ "LIBVLC" ]; enable = withLibVlc; pkgs = [ libvlc ]; } { names = [ "MTP" ]; enable = withMtp; pkgs = [ libmtp ]; } @@ -76,7 +73,7 @@ let ]; in -mkDerivation rec { +stdenv.mkDerivation rec { pname = "cantata"; version = "2.5.0"; @@ -99,13 +96,13 @@ mkDerivation rec { ''; buildInputs = [ - qtbase - qtsvg + qt6.qtbase + qt6.qtsvg (perl.withPackages (ppkgs: with ppkgs; [ URI ])) ] ++ lib.flatten (builtins.catAttrs "pkgs" (builtins.filter (e: e.enable) options)); - nativeBuildInputs = [ cmake pkg-config qttools ]; + nativeBuildInputs = [ cmake pkg-config qt6.qttools ]; cmakeFlags = lib.flatten (map (e: map (f: fstat e.enable f) e.names) options); diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f32f5a321df0..1caa45594e8a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6119,8 +6119,6 @@ with pkgs; davix-copy = davix.override { enableThirdPartyCopy = true; }; - cantata = libsForQt5.callPackage ../applications/audio/cantata { }; - cantoolz = callPackage ../tools/networking/cantoolz { }; can-utils = callPackage ../os-specific/linux/can-utils { }; From 7eb0c885d46afec212c9f7523d29985f6e0c6b01 Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Wed, 6 Nov 2024 18:14:16 +0800 Subject: [PATCH 2/4] cantata: nixfmt --- pkgs/by-name/ca/cantata/package.nix | 189 ++++++++++++++++++++-------- 1 file changed, 135 insertions(+), 54 deletions(-) diff --git a/pkgs/by-name/ca/cantata/package.nix b/pkgs/by-name/ca/cantata/package.nix index 27acc7d2a5cb..2a788d55496a 100644 --- a/pkgs/by-name/ca/cantata/package.nix +++ b/pkgs/by-name/ca/cantata/package.nix @@ -1,40 +1,41 @@ -{ stdenv -, lib -, fetchFromGitHub -, cmake -, pkg-config -, qt6 -, perl +{ + stdenv, + lib, + fetchFromGitHub, + cmake, + pkg-config, + qt6, + perl, # Cantata doesn't build with cdparanoia enabled so we disable that # default for now until I (or someone else) figure it out. -, withCdda ? false -, cdparanoia -, withCddb ? false -, libcddb -, withLame ? false -, lame -, withMusicbrainz ? false -, libmusicbrainz5 + withCdda ? false, + cdparanoia, + withCddb ? false, + libcddb, + withLame ? false, + lame, + withMusicbrainz ? false, + libmusicbrainz5, -, withTaglib ? true -, taglib -, taglib_extras -, withHttpStream ? true -, withReplaygain ? true -, ffmpeg -, speex -, mpg123 -, withMtp ? true -, libmtp -, withOnlineServices ? true -, withDevices ? true -, udisks2 -, withDynamic ? true -, withHttpServer ? true -, withLibVlc ? false -, libvlc -, withStreams ? true + withTaglib ? true, + taglib, + taglib_extras, + withHttpStream ? true, + withReplaygain ? true, + ffmpeg, + speex, + mpg123, + withMtp ? true, + libmtp, + withOnlineServices ? true, + withDevices ? true, + udisks2, + withDynamic ? true, + withHttpServer ? true, + withLibVlc ? false, + libvlc, + withStreams ? true, }: # Inter-dependencies. @@ -48,28 +49,105 @@ assert withReplaygain -> withTaglib; assert withLibVlc -> withHttpStream; let - fstat = x: fn: - "-DENABLE_${fn}=${if x then "ON" else "OFF"}"; + fstat = x: fn: "-DENABLE_${fn}=${if x then "ON" else "OFF"}"; withUdisks = (withTaglib && withDevices); options = [ - { names = [ "CDDB" ]; enable = withCddb; pkgs = [ libcddb ]; } - { names = [ "CDPARANOIA" ]; enable = withCdda; pkgs = [ cdparanoia ]; } - { names = [ "DEVICES_SUPPORT" ]; enable = withDevices; pkgs = [ ]; } - { names = [ "DYNAMIC" ]; enable = withDynamic; pkgs = [ ]; } - { names = [ "FFMPEG" "MPG123" "SPEEXDSP" ]; enable = withReplaygain; pkgs = [ ffmpeg speex mpg123 ]; } - { names = [ "HTTPS_SUPPORT" ]; enable = true; pkgs = [ ]; } - { names = [ "HTTP_SERVER" ]; enable = withHttpServer; pkgs = [ ]; } - { names = [ "HTTP_STREAM_PLAYBACK" ]; enable = withHttpStream; pkgs = [ qt6.qtmultimedia ]; } - { names = [ "LAME" ]; enable = withLame; pkgs = [ lame ]; } - { names = [ "LIBVLC" ]; enable = withLibVlc; pkgs = [ libvlc ]; } - { names = [ "MTP" ]; enable = withMtp; pkgs = [ libmtp ]; } - { names = [ "MUSICBRAINZ" ]; enable = withMusicbrainz; pkgs = [ libmusicbrainz5 ]; } - { names = [ "ONLINE_SERVICES" ]; enable = withOnlineServices; pkgs = [ ]; } - { names = [ "STREAMS" ]; enable = withStreams; pkgs = [ ]; } - { names = [ "TAGLIB" "TAGLIB_EXTRAS" ]; enable = withTaglib; pkgs = [ taglib taglib_extras ]; } - { names = [ "UDISKS2" ]; enable = withUdisks; pkgs = [ udisks2 ]; } + { + names = [ "CDDB" ]; + enable = withCddb; + pkgs = [ libcddb ]; + } + { + names = [ "CDPARANOIA" ]; + enable = withCdda; + pkgs = [ cdparanoia ]; + } + { + names = [ "DEVICES_SUPPORT" ]; + enable = withDevices; + pkgs = [ ]; + } + { + names = [ "DYNAMIC" ]; + enable = withDynamic; + pkgs = [ ]; + } + { + names = [ + "FFMPEG" + "MPG123" + "SPEEXDSP" + ]; + enable = withReplaygain; + pkgs = [ + ffmpeg + speex + mpg123 + ]; + } + { + names = [ "HTTPS_SUPPORT" ]; + enable = true; + pkgs = [ ]; + } + { + names = [ "HTTP_SERVER" ]; + enable = withHttpServer; + pkgs = [ ]; + } + { + names = [ "HTTP_STREAM_PLAYBACK" ]; + enable = withHttpStream; + pkgs = [ qt6.qtmultimedia ]; + } + { + names = [ "LAME" ]; + enable = withLame; + pkgs = [ lame ]; + } + { + names = [ "LIBVLC" ]; + enable = withLibVlc; + pkgs = [ libvlc ]; + } + { + names = [ "MTP" ]; + enable = withMtp; + pkgs = [ libmtp ]; + } + { + names = [ "MUSICBRAINZ" ]; + enable = withMusicbrainz; + pkgs = [ libmusicbrainz5 ]; + } + { + names = [ "ONLINE_SERVICES" ]; + enable = withOnlineServices; + pkgs = [ ]; + } + { + names = [ "STREAMS" ]; + enable = withStreams; + pkgs = [ ]; + } + { + names = [ + "TAGLIB" + "TAGLIB_EXTRAS" + ]; + enable = withTaglib; + pkgs = [ + taglib + taglib_extras + ]; + } + { + names = [ "UDISKS2" ]; + enable = withUdisks; + pkgs = [ udisks2 ]; + } ]; in @@ -99,10 +177,13 @@ stdenv.mkDerivation rec { qt6.qtbase qt6.qtsvg (perl.withPackages (ppkgs: with ppkgs; [ URI ])) - ] - ++ lib.flatten (builtins.catAttrs "pkgs" (builtins.filter (e: e.enable) options)); + ] ++ lib.flatten (builtins.catAttrs "pkgs" (builtins.filter (e: e.enable) options)); - nativeBuildInputs = [ cmake pkg-config qt6.qttools ]; + nativeBuildInputs = [ + cmake + pkg-config + qt6.qttools + ]; cmakeFlags = lib.flatten (map (e: map (f: fstat e.enable f) e.names) options); From 7f6faa95169f5b8b79f0ec573b013144a4df4c0e Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Wed, 6 Nov 2024 18:15:38 +0800 Subject: [PATCH 3/4] cantata: pin to ffmpeg_6 --- pkgs/by-name/ca/cantata/package.nix | 29 +++++++++++++++-------------- pkgs/top-level/all-packages.nix | 4 ++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/ca/cantata/package.nix b/pkgs/by-name/ca/cantata/package.nix index 2a788d55496a..012e10641e9d 100644 --- a/pkgs/by-name/ca/cantata/package.nix +++ b/pkgs/by-name/ca/cantata/package.nix @@ -4,7 +4,7 @@ fetchFromGitHub, cmake, pkg-config, - qt6, + qt5, perl, # Cantata doesn't build with cdparanoia enabled so we disable that @@ -51,7 +51,7 @@ assert withLibVlc -> withHttpStream; let fstat = x: fn: "-DENABLE_${fn}=${if x then "ON" else "OFF"}"; - withUdisks = (withTaglib && withDevices); + withUdisks = (withTaglib && withDevices && stdenv.hostPlatform.isLinux); options = [ { @@ -100,7 +100,7 @@ let { names = [ "HTTP_STREAM_PLAYBACK" ]; enable = withHttpStream; - pkgs = [ qt6.qtmultimedia ]; + pkgs = [ qt5.qtmultimedia ]; } { names = [ "LAME" ]; @@ -151,15 +151,15 @@ let ]; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "cantata"; version = "2.5.0"; src = fetchFromGitHub { owner = "CDrummond"; repo = "cantata"; - rev = "v${version}"; - sha256 = "sha256-UaZEKZvCA50WsdQSSJQQ11KTK6rM4ouCHDX7pn3NlQw="; + rev = "v${finalAttrs.version}"; + hash = "sha256-UaZEKZvCA50WsdQSSJQQ11KTK6rM4ouCHDX7pn3NlQw="; }; patches = [ @@ -174,27 +174,28 @@ stdenv.mkDerivation rec { ''; buildInputs = [ - qt6.qtbase - qt6.qtsvg + qt5.qtbase + qt5.qtsvg (perl.withPackages (ppkgs: with ppkgs; [ URI ])) ] ++ lib.flatten (builtins.catAttrs "pkgs" (builtins.filter (e: e.enable) options)); nativeBuildInputs = [ cmake pkg-config - qt6.qttools + qt5.qttools + qt5.wrapQtAppsHook ]; cmakeFlags = lib.flatten (map (e: map (f: fstat e.enable f) e.names) options); - meta = with lib; { + meta = { description = "Graphical client for MPD"; mainProgram = "cantata"; homepage = "https://github.com/cdrummond/cantata"; - license = licenses.gpl3Only; - maintainers = with maintainers; [ peterhoeg ]; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ peterhoeg ]; # Technically, Cantata should run on Darwin/Windows so if someone wants to # bother figuring that one out, be my guest. - platforms = platforms.linux; + platforms = lib.platforms.unix; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1caa45594e8a..d199ec985580 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -38375,4 +38375,8 @@ with pkgs; dillo = callPackage ../by-name/di/dillo/package.nix { fltk = fltk13; }; + + cantata = callPackage ../by-name/ca/cantata/package.nix { + ffmpeg = ffmpeg_6; + }; } From beef1f179faacfdc9c49bf7095bf5a2c7e6c35f9 Mon Sep 17 00:00:00 2001 From: Bot_wxt1221 <3264117476@qq.com> Date: Thu, 7 Nov 2024 08:44:39 +0800 Subject: [PATCH 4/4] cantata: mark darwin as badPlatform Co-authored-by: Austin Horstman --- pkgs/by-name/ca/cantata/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/ca/cantata/package.nix b/pkgs/by-name/ca/cantata/package.nix index 012e10641e9d..7bb809dae7ee 100644 --- a/pkgs/by-name/ca/cantata/package.nix +++ b/pkgs/by-name/ca/cantata/package.nix @@ -197,5 +197,6 @@ stdenv.mkDerivation (finalAttrs: { # Technically, Cantata should run on Darwin/Windows so if someone wants to # bother figuring that one out, be my guest. platforms = lib.platforms.unix; + badPlatforms = lib.platforms.darwin; }; })