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; {