lol
1{ stdenv, lib, fetchurl, lame, mplayer, libpulseaudio, portaudio
2, python, pyqt4, pythonPackages
3# This little flag adds a huge number of dependencies, but we assume that
4# everyone wants Anki to draw plots with statistics by default.
5, plotsSupport ? true }:
6
7let
8 py = pythonPackages;
9 version = "2.0.32";
10in
11stdenv.mkDerivation rec {
12 name = "anki-${version}";
13 src = fetchurl {
14 urls = [
15 "http://ankisrs.net/download/mirror/${name}.tgz"
16 "http://ankisrs.net/download/mirror/archive/${name}.tgz"
17 ];
18 sha256 = "0g5rmg0yqh40a3g8ci3y3if7vw4jl5nrpq8ki1a13a3xmgch13rr";
19 };
20
21 pythonPath = [ pyqt4 py.pysqlite py.sqlalchemy9 py.pyaudio ]
22 ++ lib.optional plotsSupport py.matplotlib;
23
24 buildInputs = [ python py.wrapPython lame mplayer libpulseaudio ];
25
26 preConfigure = ''
27 substituteInPlace anki/anki \
28 --replace /usr/share/ $out/share/
29
30 substituteInPlace Makefile \
31 --replace PREFIX=/usr PREFIX=$out \
32 --replace /local/bin/ /bin/
33
34 sed -i '/xdg-mime/ d' Makefile
35 '';
36
37 preInstall = ''
38 mkdir -p $out/bin
39 mkdir -p $out/share/pixmaps
40 mkdir -p $out/share/applications
41 mkdir -p $out/share/man/man1
42 '';
43
44 postInstall = ''
45 mkdir -p "$out/lib/${python.libPrefix}/site-packages"
46 ln -s "$out/share/anki/"* $out/lib/${python.libPrefix}/site-packages/
47 export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
48 wrapPythonPrograms
49 '';
50
51 meta = {
52 homepage = http://ankisrs.net/;
53 description = "Spaced repetition flashcard program";
54 license = stdenv.lib.licenses.gpl3;
55
56 longDescription = ''
57 Anki is a program which makes remembering things easy. Because it is a lot
58 more efficient than traditional study methods, you can either greatly
59 decrease your time spent studying, or greatly increase the amount you learn.
60
61 Anyone who needs to remember things in their daily life can benefit from
62 Anki. Since it is content-agnostic and supports images, audio, videos and
63 scientific markup (via LaTeX), the possibilities are endless. For example:
64 learning a language, studying for medical and law exams, memorizing
65 people's names and faces, brushing up on geography, mastering long poems,
66 or even practicing guitar chords!
67 '';
68
69 maintainers = with stdenv.lib.maintainers; [ the-kenny ];
70 platforms = stdenv.lib.platforms.mesaPlatforms;
71 };
72}