From 4010639d5e06d09d15695dadd26c2c169ea8a879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 6 Feb 2019 08:27:05 +0000 Subject: [PATCH] flameshot: fix executable path in dbus service also some minor tweaks that makes the package more robust. --- pkgs/tools/misc/flameshot/default.nix | 37 +++++++++++++++------------ 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/pkgs/tools/misc/flameshot/default.nix b/pkgs/tools/misc/flameshot/default.nix index 3be418af823c..16a46ac1432b 100644 --- a/pkgs/tools/misc/flameshot/default.nix +++ b/pkgs/tools/misc/flameshot/default.nix @@ -1,25 +1,14 @@ { stdenv, fetchFromGitHub, qtbase, qmake, qttools, qtsvg }: +# To use `flameshot gui`, you will also need to put flameshot in `services.dbus.packages` +# in configuration.nix so that the daemon gets launched properly: +# +# services.dbus.packages = [ pkgs.flameshot ]; +# environment.systemPackages = [ pkgs.flameshot ]; stdenv.mkDerivation rec { name = "flameshot-${version}"; version = "0.6.0"; - nativeBuildInputs = [ qmake qttools qtsvg ]; - buildInputs = [ qtbase ]; - - qmakeFlags = [ - # flameshot.pro assumes qmake is being run in a git checkout and uses it - # to determine the version being built. Let's replace that. - "VERSION=${version}" - "PREFIX=/" - ]; - patchPhase = '' - sed -i 's/VERSION =/#VERSION =/g' flameshot.pro - sed -i 's,USRPATH = /usr/local,USRPATH = /,g' flameshot.pro - ''; - - installFlags = [ "INSTALL_ROOT=$(out)" ]; - src = fetchFromGitHub { owner = "lupoDharkael"; repo = "flameshot"; @@ -27,6 +16,22 @@ stdenv.mkDerivation rec { sha256 = "193szslh55v44jzxzx5g9kxhl8p8di7vbcnxlid4acfidhnvgazm"; }; + nativeBuildInputs = [ qmake qttools qtsvg ]; + buildInputs = [ qtbase ]; + + qmakeFlags = [ "PREFIX=${placeholder "out"}" ]; + + preConfigure = '' + # flameshot.pro assumes qmake is being run in a git checkout. + git() { echo ${version}; } + export -f git + ''; + + postFixup = '' + substituteInPlace $out/share/dbus-1/services/org.dharkael.Flameshot.service \ + --replace "/usr/local" "$out" + ''; + enableParallelBuilding = true; meta = with stdenv.lib; {