2014-08-14 06:00:00 +01:00
|
|
|
{ stdenv, lib, fetchurl, buildPythonPackage, pythonPackages, pygtk, pygobject, python }:
|
|
|
|
|
|
|
|
#
|
|
|
|
# TODO: Declare configuration options for the following optional dependencies:
|
|
|
|
# - File stores: hg, git, bzr
|
|
|
|
# - Included plugins depenencies: dot, ditaa, dia, any other?
|
|
|
|
# - pyxdg: Need to make it work first (see setupPyInstallFlags).
|
|
|
|
#
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
name = "zim-${version}";
|
2015-08-11 18:10:15 +01:00
|
|
|
version = "0.63";
|
2014-08-14 06:00:00 +01:00
|
|
|
namePrefix = "";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2014-11-26 10:19:36 +00:00
|
|
|
url = "http://zim-wiki.org/downloads/${name}.tar.gz";
|
2015-08-11 18:10:15 +01:00
|
|
|
sha256 = "077vf4h0hjmbk8bxj9l0z9rxcb3dw642n32lvfn6vjdna1qm910m";
|
2014-08-14 06:00:00 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ pythonPackages.sqlite3 pygtk /*pythonPackages.pyxdg*/ pygobject ];
|
|
|
|
|
|
|
|
preBuild = ''
|
2014-09-04 22:53:54 +01:00
|
|
|
mkdir -p /tmp/home
|
|
|
|
export HOME="/tmp/home"
|
2014-08-14 06:00:00 +01:00
|
|
|
'';
|
|
|
|
|
2015-11-18 16:56:26 +00:00
|
|
|
setupPyBuildFlags = ["--skip-xdg-cmd"];
|
2014-08-14 06:00:00 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Exactly identical to buildPythonPackage's version but for the
|
|
|
|
# `--old-and-unmanagable`, which I removed. This was removed because
|
|
|
|
# this is a setuptools specific flag and as zim is overriding
|
|
|
|
# the install step, setuptools could not perform its monkey
|
|
|
|
# patching trick for the command. Alternate solutions were to
|
|
|
|
#
|
|
|
|
# - Remove the custom install step (tested as working but
|
|
|
|
# also remove the possibility of performing the xdg-cmd
|
|
|
|
# stuff).
|
|
|
|
# - Explicitly replace distutils import(s) by their setuptools
|
|
|
|
# equivalent (untested).
|
|
|
|
#
|
|
|
|
# Both solutions were judged unsatisfactory as altering the code
|
|
|
|
# would be required.
|
|
|
|
#
|
|
|
|
# Note that a improved solution would be to expose the use of
|
|
|
|
# the `--old-and-unmanagable` flag as an option of passed to the
|
|
|
|
# buildPythonPackage function.
|
|
|
|
#
|
|
|
|
# Also note that I stripped all comments.
|
|
|
|
#
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p "$out/lib/${python.libPrefix}/site-packages"
|
|
|
|
|
|
|
|
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
|
|
|
|
|
|
|
|
${python}/bin/${python.executable} setup.py install \
|
|
|
|
--install-lib=$out/lib/${python.libPrefix}/site-packages \
|
2015-11-18 16:56:26 +00:00
|
|
|
--prefix="$out" ${lib.concatStringsSep " " setupPyBuildFlags}
|
2014-08-14 06:00:00 +01:00
|
|
|
|
|
|
|
eapth="$out/lib/${python.libPrefix}"/site-packages/easy-install.pth
|
|
|
|
if [ -e "$eapth" ]; then
|
|
|
|
# move colliding easy_install.pth to specifically named one
|
|
|
|
mv "$eapth" $(dirname "$eapth")/${name}.pth
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py*
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2014-09-04 22:53:54 +01:00
|
|
|
|
|
|
|
# FIXME: this is quick and dirty hack, because zim expects the
|
|
|
|
# path to the executable in argv[0] therefore the wrapper is
|
|
|
|
# modified accordingly.
|
|
|
|
postFixup = ''
|
2015-03-09 16:31:47 +00:00
|
|
|
wrapProgram "$out/bin/zim" \
|
|
|
|
--prefix XDG_DATA_DIRS : "$out/share"
|
|
|
|
|
2014-09-04 22:53:54 +01:00
|
|
|
wrapPythonPrograms
|
|
|
|
|
2015-03-09 16:31:47 +00:00
|
|
|
sed -i "s#sys\.argv\[0\] = '.zim-wrapped'#sys.argv[0] = '$out/bin/zim'#g" \
|
|
|
|
$out/bin/..zim-wrapped-wrapped
|
2014-09-04 22:53:54 +01:00
|
|
|
|
|
|
|
if test -e $out/nix-support/propagated-build-inputs; then
|
|
|
|
ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
|
|
|
|
fi
|
|
|
|
|
|
|
|
createBuildInputsPth build-inputs "$buildInputStrings"
|
|
|
|
for inputsfile in propagated-build-inputs propagated-native-build-inputs; do
|
|
|
|
if test -e $out/nix-support/$inputsfile; then
|
|
|
|
createBuildInputsPth $inputsfile "$(cat $out/nix-support/$inputsfile)"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
2014-08-14 06:00:00 +01:00
|
|
|
|
|
|
|
# Testing fails.
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A desktop wiki";
|
|
|
|
homepage = http://zim-wiki.org;
|
|
|
|
license = stdenv.lib.licenses.gpl2Plus;
|
|
|
|
};
|
|
|
|
}
|