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-JXn4oxhRODHh6b5hFFj393xMRlaJRVcbMJ5AyXr+jq8=";
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-d94lfk1pUJgxk4Dylw+fC2qt8wfRJ7tJQYm+Chp1J5k=";
31 darwin-aarch64 = fetchurl {
32 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-apple-qt6.dmg";
33 hash = "sha256-AEpyrZBQ+0FI9CxwCacGlbMDMZ7eebBRPkQ0Nstubnk=";
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
100 runScript = writeShellScript "anki-wrapper.sh" ''
101 exec ${unpacked}/bin/anki ${lib.strings.escapeShellArgs commandLineArgs} "$@"
104 extraInstallCommands = ''
105 ln -s ${pname} $out/bin/anki
108 cp -R ${unpacked}/share/applications \
109 ${unpacked}/share/man \
110 ${unpacked}/share/pixmaps \
114 inherit meta passthru;
119 if stdenv.hostPlatform.isLinux then
122 stdenv.mkDerivation {
123 inherit pname version passthru;
125 src = if stdenv.hostPlatform.isAarch64 then sources.darwin-aarch64 else sources.darwin-x86_64;
127 nativeBuildInputs = [ undmg ];
131 mkdir -p $out/Applications/
132 cp -a Anki.app $out/Applications/