15 enableWlrSupport ? false,
16 enableMonochromeIcon ? false,
19 assert stdenv.hostPlatform.isDarwin -> (!enableWlrSupport);
22 stdenv' = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv;
25 stdenv'.mkDerivation {
27 # wlr screenshotting is currently only available on unstable version (>12.1.0)
28 version = "12.1.0-unstable-2025-01-19";
30 src = fetchFromGitHub {
31 owner = "flameshot-org";
33 rev = "10d12e0b54d59de2ac2567c540a93113672cd884";
34 hash = "sha256-3ujqwiQrv/H1HzkpD/Q+hoqyrUdO65gA0kKqtRV0vmw=";
38 # https://github.com/flameshot-org/flameshot/pull/3166
39 # fixes fractional scaling calculations on wayland
41 name = "10-fix-wayland.patch";
42 url = "https://github.com/flameshot-org/flameshot/commit/5fea9144501f7024344d6f29c480b000b2dcd5a6.patch";
43 hash = "sha256-SnjVbFMDKD070vR4vGYrwLw6scZAFaQA4b+MbI+0W9E=";
49 (lib.cmakeBool "DISABLE_UPDATE_CHECKER" true)
50 (lib.cmakeBool "USE_MONOCHROME_ICON" enableMonochromeIcon)
52 ++ lib.optionals stdenv.hostPlatform.isLinux [
53 (lib.cmakeBool "USE_WAYLAND_CLIPBOARD" true)
54 (lib.cmakeBool "USE_WAYLAND_GRIM" enableWlrSupport)
56 ++ lib.optionals stdenv.hostPlatform.isDarwin [
57 (lib.cmakeFeature "Qt5_DIR" "${libsForQt5.qtbase.dev}/lib/cmake/Qt5")
65 libsForQt5.wrapQtAppsHook
68 ++ lib.optionals stdenv.hostPlatform.isDarwin [
78 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
79 # Fix icns generation running concurrently with png generation
80 sed -E -i '/"iconutil -o/i\
85 # Replace unavailable commands
87 -e 's/"sips -z ([0-9]+) ([0-9]+) +(.+) --out /"magick \3 -resize \1x\2\! /' \
88 -e 's/"iconutil -o (.+) -c icns (.+)"/"png2icns \1 \2\/*{16,32,128,256,512}.png"/' \
92 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
93 mkdir $out/Applications
94 mv $out/bin/flameshot.app $out/Applications
96 ln -s $out/Applications/flameshot.app/Contents/MacOS/flameshot $out/bin/flameshot
98 rm -r $out/share/applications
99 rm -r $out/share/dbus*
100 rm -r $out/share/icons
101 rm -r $out/share/metainfo
104 dontWrapQtApps = true;
109 if stdenv.hostPlatform.isDarwin then
110 "Applications/flameshot.app/Contents/MacOS/flameshot"
115 wrapProgram $out/${binary} \
116 ${lib.optionalString enableWlrSupport "--prefix PATH : ${lib.makeBinPath [ grim ]}"} \
117 ''${qtWrapperArgs[@]}
121 updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
125 description = "Powerful yet simple to use screenshot software";
126 homepage = "https://github.com/flameshot-org/flameshot";
127 changelog = "https://github.com/flameshot-org/flameshot/releases";
128 mainProgram = "flameshot";
129 maintainers = with maintainers; [
133 license = licenses.gpl3Plus;
134 platforms = platforms.linux ++ platforms.darwin;