diff --git a/pkgs/by-name/fl/flameshot/load-missing-deps.patch b/pkgs/by-name/fl/flameshot/load-missing-deps.patch new file mode 100644 index 000000000000..0d97e252a007 --- /dev/null +++ b/pkgs/by-name/fl/flameshot/load-missing-deps.patch @@ -0,0 +1,53 @@ +--- a/CMakeLists.txt 2025-08-15 11:37:20 ++++ b/CMakeLists.txt 2025-08-15 11:40:06 +@@ -29,21 +29,7 @@ + if(EXISTS "${CMAKE_SOURCE_DIR}/external/Qt-Color-Widgets/CMakeLists.txt") + add_subdirectory("${CMAKE_SOURCE_DIR}/external/Qt-Color-Widgets" EXCLUDE_FROM_ALL) + else() +- FetchContent_Declare( +- qtColorWidgets +- GIT_REPOSITORY https://gitlab.com/mattbas/Qt-Color-Widgets.git +- GIT_TAG 352bc8f99bf2174d5724ee70623427aa31ddc26a +- ) +- #Workaround for duplicate GUID in windows WIX installer +- if (WIN32) +- FetchContent_GetProperties(qtColorWidgets) +- if(NOT qtcolorwidgets_POPULATED) +- FetchContent_Populate(qtColorWidgets) +- add_subdirectory(${qtcolorwidgets_SOURCE_DIR} ${qtcolorwidgets_BINARY_DIR} EXCLUDE_FROM_ALL) +- endif() +- else() +- FetchContent_MakeAvailable(qtColorWidgets) +- endif() ++ find_package(QtColorWidgets REQUIRED) + endif() + + # This can be read from ${PROJECT_NAME} after project() is called +@@ -115,12 +101,7 @@ + if(EXISTS "${CMAKE_SOURCE_DIR}/external/KDSingleApplication/CMakeLists.txt") + add_subdirectory("${CMAKE_SOURCE_DIR}/external/KDSingleApplication") + else() +- FetchContent_Declare( +- kdsingleApplication +- GIT_REPOSITORY https://github.com/KDAB/KDSingleApplication.git +- GIT_TAG v1.2.0 +- ) +- FetchContent_MakeAvailable(KDSingleApplication) ++ find_package(KDSingleApplication-qt6 REQUIRED) + endif() + endif() + +@@ -128,12 +109,7 @@ + option(BUILD_STATIC_LIBS ON) + + if (APPLE) +- FetchContent_Declare( +- qHotKey +- GIT_REPOSITORY https://github.com/flameshot-org/QHotkey +- GIT_TAG master +- ) +- FetchContent_MakeAvailable(QHotKey) ++ find_package(QHotKey REQUIRED) + endif() + + add_subdirectory(src) diff --git a/pkgs/by-name/fl/flameshot/macos-build.patch b/pkgs/by-name/fl/flameshot/macos-build.patch new file mode 100644 index 000000000000..3c18ac8e0eef --- /dev/null +++ b/pkgs/by-name/fl/flameshot/macos-build.patch @@ -0,0 +1,76 @@ +--- a/src/CMakeLists.txt 2025-08-12 16:34:27 ++++ b/src/CMakeLists.txt 2025-08-15 11:45:56 +@@ -220,7 +220,7 @@ + + target_link_libraries( + flameshot +- kdsingleapplication ++ kdsingleapplication-qt6 + ) + endif() + +@@ -447,64 +447,3 @@ + endif () + endif () + +-# macdeployqt +-if (APPLE) +-# Code signing settings - optional, set to empty string to skip signing +- set(CODE_SIGN_IDENTITY "" CACHE STRING "Code signing identity (leave empty to skip signing)") +- set(DMG_SIGN_IDENTITY "" CACHE STRING "DMG signing identity (leave empty to skip signing)") +- # Custom target to create DMG (signed or unsigned) +- add_custom_target(create_dmg +- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../packaging/macos/create_dmg.sh +- "${CMAKE_CURRENT_BINARY_DIR}/Flameshot.app" +- "${CMAKE_CURRENT_BINARY_DIR}/Flameshot-${PROJECT_VERSION}.dmg" +- "${CODE_SIGN_IDENTITY}" +- "${DMG_SIGN_IDENTITY}" +- DEPENDS flameshot +- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +- COMMENT "Creating DMG" +- VERBATIM +- ) +- +-# Always sign the app bundle (either with identity or ad hoc) +- if(CODE_SIGN_IDENTITY AND NOT CODE_SIGN_IDENTITY STREQUAL "") +- # Identity-based signing (requires Developer ID) +- add_custom_command(TARGET flameshot POST_BUILD +- COMMAND codesign --force --deep --sign "${CODE_SIGN_IDENTITY}" +- --options runtime --timestamp "$" +- COMMENT "Code signing app bundle with ${CODE_SIGN_IDENTITY}" +- ) +- else() +- # Ad hoc signing +- add_custom_command(TARGET flameshot POST_BUILD +- COMMAND codesign --force --deep --sign - "$" +- COMMENT "Ad hoc code signing app bundle (no identity required)" +- ) +- endif() +- # Deploy Qt libraries and dependencies +- find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS ${Qt6_DIR}/../../../bin) +- +- if(MACDEPLOYQT_EXECUTABLE) +- add_custom_command(TARGET flameshot POST_BUILD +- COMMAND ${MACDEPLOYQT_EXECUTABLE} "$" -verbose=2 +- COMMENT "Deploying Qt libraries" +- ) +- +- # Re-sign after macdeployqt (it modifies the bundle) +- if(CODE_SIGN_IDENTITY AND NOT CODE_SIGN_IDENTITY STREQUAL "") +- add_custom_command(TARGET flameshot POST_BUILD +- COMMAND codesign --force --deep --sign "${CODE_SIGN_IDENTITY}" +- --options runtime --timestamp "$" +- COMMENT "Re-signing app bundle after Qt deployment" +- ) +- else() +- add_custom_command(TARGET flameshot POST_BUILD +- COMMAND codesign --force --deep --sign - "$" +- COMMENT "Re-signing app bundle after Qt deployment (ad hoc)" +- ) +- endif() +- else() +- message(WARNING "macdeployqt not found. App may not run on systems without Qt installed.") +- endif() +- +- +-endif () diff --git a/pkgs/by-name/fl/flameshot/package.nix b/pkgs/by-name/fl/flameshot/package.nix index c7de7abbbec7..5419f6cb8a65 100644 --- a/pkgs/by-name/fl/flameshot/package.nix +++ b/pkgs/by-name/fl/flameshot/package.nix @@ -2,13 +2,13 @@ stdenv, lib, fetchFromGitHub, - fetchpatch, cmake, imagemagick, libicns, - libsForQt5, + kdePackages, grim, makeBinaryWrapper, + kdsingleapplication, nix-update-script, enableWlrSupport ? false, enableMonochromeIcon ? false, @@ -16,45 +16,42 @@ assert stdenv.hostPlatform.isDarwin -> (!enableWlrSupport); -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "flameshot"; - # wlr screenshotting is currently only available on unstable version (>12.1.0) - version = "12.1.0-unstable-2025-05-04"; + version = "13.0.1"; src = fetchFromGitHub { owner = "flameshot-org"; repo = "flameshot"; - rev = "f4cde19c63473f8fadd448ad2056c22f0f847f34"; - hash = "sha256-B/piB8hcZR11vnzvue/1eR+SFviTSGJoek1w4abqsek="; + tag = "v${finalAttrs.version}"; + hash = "sha256-Zo+rhvpwhcYqgn8PZ0b48sCb/YWqGSormFnY6pbY8Qc="; }; - patches = [ - # https://github.com/flameshot-org/flameshot/pull/3166 - # fixes fractional scaling calculations on wayland - (fetchpatch { - name = "10-fix-wayland.patch"; - url = "https://github.com/flameshot-org/flameshot/commit/5fea9144501f7024344d6f29c480b000b2dcd5a6.patch"; - hash = "sha256-SnjVbFMDKD070vR4vGYrwLw6scZAFaQA4b+MbI+0W9E="; - }) - ]; - cmakeFlags = [ + "-DCMAKE_CXX_FLAGS=-I${kdsingleapplication}/include/kdsingleapplication-qt6" (lib.cmakeBool "DISABLE_UPDATE_CHECKER" true) (lib.cmakeBool "USE_MONOCHROME_ICON" enableMonochromeIcon) ] ++ lib.optionals stdenv.hostPlatform.isLinux [ (lib.cmakeBool "USE_WAYLAND_CLIPBOARD" true) - (lib.cmakeBool "USE_WAYLAND_GRIM" enableWlrSupport) ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - (lib.cmakeFeature "Qt5_DIR" "${libsForQt5.qtbase.dev}/lib/cmake/Qt5") + (lib.cmakeFeature "Qt6_DIR" "${kdePackages.qtbase}/lib/cmake/Qt6") + ]; + + # 1. "load-missing-deps" prevents from build inputs being fetched via GitHub. + # 2. "macos-build" mainly patches out the use of codesigning + macdeployqt, + # which incorrectly fetches Qt libraries. + # 2.1 Also fixes target link to "kdsingpleapplications-qt6" as in Nixpkgs. + patches = [ + ./load-missing-deps.patch + ./macos-build.patch ]; nativeBuildInputs = [ cmake - libsForQt5.qttools - libsForQt5.qtsvg - libsForQt5.wrapQtAppsHook + kdePackages.qttools + kdePackages.wrapQtAppsHook makeBinaryWrapper ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ @@ -63,22 +60,25 @@ stdenv.mkDerivation { ]; buildInputs = [ - libsForQt5.qtbase - libsForQt5.kguiaddons + kdsingleapplication + kdePackages.qt-color-widgets + kdePackages.qtbase + kdePackages.qtsvg + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + kdePackages.qtwayland # Included explicitly due to reported inconsistencies without it. + kdePackages.kguiaddons + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + kdePackages.qhotkey ]; postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' - # Fix icns generation running concurrently with png generation - sed -E -i '/"iconutil -o/i\ - )\ - execute_process(\ - ' src/CMakeLists.txt - - # Replace unavailable commands - sed -E -i \ - -e 's/"sips -z ([0-9]+) ([0-9]+) +(.+) --out /"magick \3 -resize \1x\2\! /' \ - -e 's/"iconutil -o (.+) -c icns (.+)"/"png2icns \1 \2\/*{16,32,128,256,512}.png"/' \ - src/CMakeLists.txt + # Replace sips with imagemagick and iconutil with png2icns. + sed -i -E \ + -e 's|sips -z ([0-9]+) ([0-9]+) +(.+) --out (.+)|magick \3 -resize \1x\2\\! \4|g' \ + -e 's|iconutil -o \\?"([^"]+)" -c icns \\?"([^"]+)"|png2icns \1 \2/*\{16,32,128,256,512\}.png|' \ + src/CMakeLists.txt ''; postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' @@ -109,20 +109,19 @@ stdenv.mkDerivation { ''${qtWrapperArgs[@]} ''; - passthru = { - updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; }; - }; + passthru.updateScript = nix-update-script { }; - meta = with lib; { + meta = { description = "Powerful yet simple to use screenshot software"; homepage = "https://github.com/flameshot-org/flameshot"; changelog = "https://github.com/flameshot-org/flameshot/releases"; mainProgram = "flameshot"; - maintainers = with maintainers; [ + maintainers = with lib.maintainers; [ scode oxalica + dmkhitaryan ]; - license = licenses.gpl3Plus; - platforms = platforms.linux ++ platforms.darwin; + license = lib.licenses.gpl3Plus; + platforms = lib.platforms.linux ++ lib.platforms.darwin; }; -} +})