flameshot: fix executable path in dbus service

also some minor tweaks that makes the package more robust.
This commit is contained in:
Jörg Thalheim 2019-02-06 08:27:05 +00:00
parent ac098c2e62
commit 4010639d5e
No known key found for this signature in database
GPG Key ID: B3F5D81B0C6967C4

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