at 22.05-pre 76 lines 2.9 kB view raw
1{ lib, stdenv, fetchFromGitHub, cmake, qt4, quazip, qt-mobility, qxt, pythonPackages }: 2 3with lib; 4stdenv.mkDerivation rec { 5 pname = "screencloud"; 6 version = "1.2.0"; 7 8 # API Keys. According to the author of the AUR package, these are only used 9 # for tracking usage. 10 consumerKey = "23e747012c68601f27ab69c6de129ed70552d55b6"; 11 consumerSecret = "4701cb00c1bd357bbcae7c3d713dd216"; 12 13 src = fetchFromGitHub { 14 owner = "olav-st"; 15 repo = "screencloud"; 16 rev = "v${version}"; 17 sha256 = "1s0dxa1sa37nvna5nfqdsp294810favj68qb7ghl78qna7zw0cim"; 18 }; 19 20 nativeBuildInputs = [ cmake ]; 21 buildInputs = [ qt4 quazip qt-mobility qxt pythonPackages.python pythonPackages.pycrypto ]; 22 23 patchPhase = '' 24 # Required to make the configure script work. Normally, screencloud's 25 # CMakeLists file sets the install prefix to /opt by force. This is stupid 26 # and breaks nix, so we force it to install where we want. Please don't 27 # write CMakeLists files like this, as things like this are why we can't 28 # have nice things. 29 substituteInPlace "CMakeLists.txt" --replace "set(CMAKE_INSTALL_PREFIX \"/opt\")" "" 30 ''; 31 32 # We need to append /opt to our CMAKE_INSTALL_PREFIX, so we tell the Nix not 33 # to add the argument for us. 34 dontAddPrefix = true; 35 36 cmakeFlags = [ 37 "-DQXT_QXTCORE_INCLUDE_DIR=${qxt}/include/QxtCore" 38 "-DQXT_QXTCORE_LIB_RELEASE=${qxt}/lib/libQxtCore.so" 39 "-DQXT_QXTGUI_INCLUDE_DIR=${qxt}/include/QxtGui" 40 "-DQXT_QXTGUI_LIB_RELEASE=${qxt}/lib/libQxtGui.so" 41 "-DCONSUMER_KEY_SCREENCLOUD=${consumerKey}" 42 "-DCONSUMER_SECRET_SCREENCLOUD=${consumerSecret}" 43 ]; 44 45 setSourceRoot = '' 46 sourceRoot=$(echo */screencloud) 47 ''; 48 49 preConfigure = '' 50 # This needs to be set in preConfigure instead of cmakeFlags in order to 51 # access the $prefix environment variable. 52 export cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix/opt $cmakeFlags" 53 ''; 54 55 # There are a number of issues with screencloud's installation. We need to add 56 # pycrypto to the PYTHONPATH so that the SFTP plugin will work properly; and 57 # we need to move the libPythonQt library into a folder where it can actually 58 # be found. 59 postInstall = '' 60 patchShebangs $prefix/opt/screencloud/screencloud.sh 61 substituteInPlace "$prefix/opt/screencloud/screencloud.sh" --replace "/opt" "$prefix/opt" 62 sed -i "2 i\export PYTHONPATH=$(toPythonPath ${pythonPackages.pycrypto}):\$PYTHONPATH" "$prefix/opt/screencloud/screencloud.sh" 63 mkdir $prefix/bin 64 mkdir $prefix/lib 65 ln -s $prefix/opt/screencloud/screencloud.sh $prefix/bin/screencloud 66 ln -s $prefix/opt/screencloud/libPythonQt.so $prefix/lib/libPythonQt.so 67 ''; 68 69 meta = { 70 homepage = "https://screencloud.net/"; 71 description = "Client for Screencloud, an easy to use screenshot sharing tool"; 72 license = lib.licenses.gpl2; 73 maintainers = with lib.maintainers; [ forkk ]; 74 platforms = with lib.platforms; linux; 75 }; 76}