From 09ed4ac3e3e8f6eb2e32fed39370f8b438b7a47f Mon Sep 17 00:00:00 2001 From: dmkhitaryan Date: Wed, 6 Aug 2025 03:16:10 +0200 Subject: [PATCH 1/4] maintainers: add dmkhitaryan --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 5c0ee2147cfe..45542818f33a 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -6578,6 +6578,12 @@ githubId = 875324; name = "David Johnson"; }; + dmkhitaryan = { + name = "David Mkhitaryan"; + email = "d.mkhitaryan@mailbox.org"; + github = "dmkhitaryan"; + githubId = 63636798; + }; dmvianna = { email = "dmlvianna@gmail.com"; github = "dmvianna"; From 73da1baabeef77d1f9202d4ffe15aacb3e092e5b Mon Sep 17 00:00:00 2001 From: dmkhitaryan Date: Wed, 6 Aug 2025 03:19:14 +0200 Subject: [PATCH 2/4] qt-color-widgets: init at 2.2.0-unstable-2025-05-26 --- .../libraries/qt-color-widgets/default.nix | 40 +++++++++++++++++++ pkgs/top-level/qt6-packages.nix | 2 + 2 files changed, 42 insertions(+) create mode 100644 pkgs/development/libraries/qt-color-widgets/default.nix diff --git a/pkgs/development/libraries/qt-color-widgets/default.nix b/pkgs/development/libraries/qt-color-widgets/default.nix new file mode 100644 index 000000000000..fc458b026ec6 --- /dev/null +++ b/pkgs/development/libraries/qt-color-widgets/default.nix @@ -0,0 +1,40 @@ +{ + stdenv, + lib, + fetchFromGitLab, + cmake, + qtbase, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "qt-color-widgets"; + version = "2.2.0-unstable-2025-05-26"; + + src = fetchFromGitLab { + owner = "mattbas"; + repo = "qt-color-widgets"; + rev = "8491078434b24cba295b5e41cc0d2a94c7049a5b"; + hash = "sha256-77G1NU7079pvqhQnSTmMdkd2g1R2hoJxn183WcsWq8c="; + }; + + dontWrapQtApps = true; + + cmakeFlags = [ + "-DQT_VERSION_MAJOR=${lib.versions.major qtbase.version}" + ]; + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + qtbase + ]; + + meta = { + homepage = "https://gitlab.com/mattbas/Qt-Color-Widgets"; + description = "Qt (C++) widgets to manage color inputs"; + license = lib.licenses.lgpl3Plus; + maintainers = with lib.maintainers; [ dmkhitaryan ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +}) diff --git a/pkgs/top-level/qt6-packages.nix b/pkgs/top-level/qt6-packages.nix index 8a64dc00c9f9..536848b37661 100644 --- a/pkgs/top-level/qt6-packages.nix +++ b/pkgs/top-level/qt6-packages.nix @@ -95,6 +95,8 @@ makeScopeWithSplicing' { qt6gtk2 = callPackage ../tools/misc/qt6gtk2 { }; + qt-color-widgets = callPackage ../development/libraries/qt-color-widgets { }; + qtforkawesome = callPackage ../development/libraries/qtforkawesome { }; qtkeychain = callPackage ../development/libraries/qtkeychain { }; From 61d57f8bb49da718061e2bb58ec6d3ae5dd5ceb8 Mon Sep 17 00:00:00 2001 From: David Mkhitaryan Date: Sun, 10 Aug 2025 11:35:28 +0200 Subject: [PATCH 3/4] qhotkey: init at 1.5.0-unstable-2025-07-06 --- .../development/libraries/qhotkey/default.nix | 40 +++++++++++++++++++ pkgs/top-level/qt6-packages.nix | 1 + 2 files changed, 41 insertions(+) create mode 100644 pkgs/development/libraries/qhotkey/default.nix diff --git a/pkgs/development/libraries/qhotkey/default.nix b/pkgs/development/libraries/qhotkey/default.nix new file mode 100644 index 000000000000..ac140b8125a8 --- /dev/null +++ b/pkgs/development/libraries/qhotkey/default.nix @@ -0,0 +1,40 @@ +{ + stdenv, + lib, + fetchFromGitHub, + cmake, + qtbase, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "qhotkey"; + version = "1.5.0-unstable-2025-07-06"; + + src = fetchFromGitHub { + owner = "Skycoder42"; + repo = "qhotkey"; + rev = "6c0e98492c59206139f8490706aadeb8ed033057"; + hash = "sha256-F+NTVYIB55GlB+p9mgDvJD86n0xOOKMGCRDM8TtnMpo="; + }; + + dontWrapQtApps = true; + + cmakeFlags = [ + "-DQT_DEFAULT_MAJOR_VERSION=${lib.versions.major qtbase.version}" + ]; + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + qtbase + ]; + + meta = { + homepage = "https://github.com/Skycoder42/QHotkey"; + description = "Global shortcut/hotkey for Desktop Qt-Applications"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ dmkhitaryan ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +}) diff --git a/pkgs/top-level/qt6-packages.nix b/pkgs/top-level/qt6-packages.nix index 536848b37661..7d6cc2f151dd 100644 --- a/pkgs/top-level/qt6-packages.nix +++ b/pkgs/top-level/qt6-packages.nix @@ -88,6 +88,7 @@ makeScopeWithSplicing' { qcoro = callPackage ../development/libraries/qcoro { }; qcustomplot = callPackage ../development/libraries/qcustomplot { }; qgpgme = callPackage ../development/libraries/gpgme { }; + qhotkey = callPackage ../development/libraries/qhotkey { }; qmlbox2d = callPackage ../development/libraries/qmlbox2d { }; packagekit-qt = callPackage ../tools/package-management/packagekit/qt.nix { }; From 05f54c4d89a3c3bcb6ca37d866fc54901d84f973 Mon Sep 17 00:00:00 2001 From: dmkhitaryan Date: Wed, 6 Aug 2025 03:20:43 +0200 Subject: [PATCH 4/4] flameshot: 12.1.0-unstable-2025-05-04 -> 13.0.1 --- .../fl/flameshot/load-missing-deps.patch | 53 ++++++++++++ pkgs/by-name/fl/flameshot/macos-build.patch | 76 +++++++++++++++++ pkgs/by-name/fl/flameshot/package.nix | 85 +++++++++---------- 3 files changed, 171 insertions(+), 43 deletions(-) create mode 100644 pkgs/by-name/fl/flameshot/load-missing-deps.patch create mode 100644 pkgs/by-name/fl/flameshot/macos-build.patch 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; }; -} +})