12 commandLineArgs ? [ ],
17 # Update hashes for both Linux and Darwin!
22 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux-qt6.tar.zst";
23 hash = "sha256-/oyQy4QHU9DCqYplcuINy5y0d2/n+fJCpgwNDURguYU=";
26 # For some reason anki distributes completely separate dmg-files for the aarch64 version and the x86_64 version
27 darwin-x86_64 = fetchurl {
28 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-intel-qt6.dmg";
29 hash = "sha256-UQRdp/GhiRGfsBF+mV6hCKpEQGFv/I9D9KTtc1p776o=";
31 darwin-aarch64 = fetchurl {
32 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-apple-qt6.dmg";
33 hash = "sha256-zi9yjJirNxFFD7wGa4++J+mDaE5dYZW+X0UUddGkjTU=";
37 unpacked = stdenv.mkDerivation {
38 inherit pname version;
40 nativeBuildInputs = [ zstd ];
51 PREFIX=$out bash install.sh
70 maintainers = with maintainers; [ mahmoudk1000 ];
77 fhsEnvAnki = buildFHSEnv (
78 appimageTools.defaultFhsEnvArgs
80 inherit pname version;
83 # anki vendors QT and mixing QT versions usually causes crashes
85 # anki uses the system ssl cert, without it plugins do not download/update
86 export SSL_CERT_FILE="${cacert}/etc/ssl/certs/ca-bundle.crt"
89 # Dependencies of anki
99 runScript = writeShellScript "anki-wrapper.sh" ''
100 exec ${unpacked}/bin/anki ${lib.strings.escapeShellArgs commandLineArgs} "$@"
103 extraInstallCommands = ''
104 ln -s ${pname} $out/bin/anki
107 cp -R ${unpacked}/share/applications \
108 ${unpacked}/share/man \
109 ${unpacked}/share/pixmaps \
113 inherit meta passthru;
118 if stdenv.hostPlatform.isLinux then
121 stdenv.mkDerivation {
122 inherit pname version passthru;
124 src = if stdenv.hostPlatform.isAarch64 then sources.darwin-aarch64 else sources.darwin-x86_64;
126 nativeBuildInputs = [ undmg ];
130 mkdir -p $out/Applications/
131 cp -a Anki.app $out/Applications/