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