2 , buildPythonApplication
26 # This little flag adds a huge number of dependencies, but we assume that
27 # everyone wants Anki to draw plots with statistics by default.
34 # when updating, also update rev-manual to a recent version of
35 # https://github.com/ankitects/anki-docs
36 # The manual is distributed independently of the software.
38 sha256-pkg = "12dvyf3j9df4nrhhnqbzd9b21rpzkh4i6yhhangn2zf7ch0pclss";
39 rev-manual = "8f6387867ac37ef3fe9d0b986e70f898d1a49139";
40 sha256-manual = "0pm5slxn78r44ggvbksz7rv9hmlnsvn9z811r6f63dsc8vm6mfml";
42 manual = stdenv.mkDerivation {
43 pname = "anki-manual";
45 src = fetchFromGitHub {
49 sha256 = sha256-manual;
52 nativeBuildInputs = [ asciidoc ];
56 # We remove any special ankiweb output generation
57 # and rename every .mako to .html
58 sed -e 's/rsync -a/cp -a/g' \
59 -e "s|\$(WEB)/docs|$out/share/doc/anki/html|" \
60 -e '/echo asciidoc/,/mv $@.tmp $@/c \\tasciidoc -b html5 -o $@ $<' \
61 -e 's/\.mako/.html/g' \
63 # patch absolute links to the other language manuals
64 sed -e 's|https://apps.ankiweb.net/docs/|link:./|g' \
65 -i {manual.txt,manual.*.txt}
66 # there’s an artifact in most input files
67 sed -e '/<%def.*title.*/d' \
69 mkdir -p $out/share/doc/anki/html
74 buildPythonApplication rec {
81 "https://apps.ankiweb.net/downloads/current/${pname}-${version}-source.tgz"
82 # "https://apps.ankiweb.net/downloads/current/${name}-source.tgz"
83 # "http://ankisrs.net/download/mirror/${name}.tgz"
84 # "http://ankisrs.net/download/mirror/archive/${name}.tgz"
89 outputs = [ "out" "doc" "man" ];
91 propagatedBuildInputs = [
103 ++ lib.optional plotsSupport matplotlib
104 ++ lib.optionals stdenv.isDarwin [ CoreAudio ]
107 checkInputs = [ pytest glibcLocales nose ];
109 nativeBuildInputs = [ pyqtwebengine.wrapQtAppsHook ];
110 buildInputs = [ lame mpv-unwrapped libpulseaudio ];
113 # Disable updated version check.
114 ./no-version-check.patch
116 name = "fix-mpv-args.patch";
117 url = "https://sources.debian.org/data/main/a/anki/2.1.15+dfsg-3/debian/patches/fix-mpv-args.patch";
118 sha256 = "1dimnnawk64m5bbdbjrxw5k08q95l728n94cgkrrwxwavmmywaj2";
121 name = "anki-2.1.15-unescape.patch";
122 url = "https://795309.bugs.gentoo.org/attachment.cgi?id=715200";
123 sha256 = "14rz864kdaba4fd1marwkyz9n1jiqnbjy4al8bvwlhpvp0rm1qk6";
127 # Anki does not use setup.py
131 # Remove QT translation files. We'll use the standard QT ones.
134 # hitting F1 should open the local manual
135 substituteInPlace anki/consts.py \
136 --replace 'HELP_SITE="http://ankisrs.net/docs/manual.html"' \
137 'HELP_SITE="${manual}/share/doc/anki/html/manual.html"'
140 # UTF-8 locale needed for testing
141 LC_ALL = "en_US.UTF-8";
143 # tests fail with to many open files
144 doCheck = !stdenv.isDarwin;
146 # - Anki writes some files to $HOME during tests
147 # - Skip tests using network
149 HOME=$TMP pytest --ignore tests/test_sync.py
153 pp=$out/lib/${python.libPrefix}/site-packages
156 mkdir -p $out/share/applications
157 mkdir -p $doc/share/doc/anki
158 mkdir -p $man/share/man/man1
159 mkdir -p $out/share/mime/packages
160 mkdir -p $out/share/pixmaps
163 cat > $out/bin/anki <<EOF
164 #!${python}/bin/python
168 chmod 755 $out/bin/anki
170 cp -v anki.desktop $out/share/applications/
171 cp -v README* LICENSE* $doc/share/doc/anki/
172 cp -v anki.1 $man/share/man/man1/
173 cp -v anki.xml $out/share/mime/packages/
174 cp -v anki.{png,xpm} $out/share/pixmaps/
175 cp -rv locale $out/share/
176 cp -rv anki aqt web $pp/
178 # copy the manual into $doc
179 cp -r ${manual}/share/doc/anki/html $doc/share/doc/anki
182 # now wrapPythonPrograms from postFixup will add both python and qt env variables
183 dontWrapQtApps = true;
187 "''${qtWrapperArgs[@]}"
188 --prefix PATH ':' "${lame}/bin:${mpv-unwrapped}/bin"
197 homepage = "https://apps.ankiweb.net/";
198 description = "Spaced repetition flashcard program";
200 Anki is a program which makes remembering things easy. Because it is a lot
201 more efficient than traditional study methods, you can either greatly
202 decrease your time spent studying, or greatly increase the amount you learn.
204 Anyone who needs to remember things in their daily life can benefit from
205 Anki. Since it is content-agnostic and supports images, audio, videos and
206 scientific markup (via LaTeX), the possibilities are endless. For example:
207 learning a language, studying for medical and law exams, memorizing
208 people's names and faces, brushing up on geography, mastering long poems,
209 or even practicing guitar chords!
211 license = licenses.agpl3Plus;
212 platforms = platforms.mesaPlatforms;
213 maintainers = with maintainers; [ oxij Profpatsch ];