1 { fetchurl, stdenv, lib, buildFHSUserEnv, appimageTools, writeShellScript, anki, undmg, zstd }:
5 # Update hashes for both Linux and Darwin!
10 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux-qt6.tar.zst";
11 sha256 = "sha256-NFhgVd4ctEsh7iaSZ9v0OMszd81H41eq+y+FRIhcCtE=";
14 # For some reason anki distributes completely separate dmg-files for the aarch64 version and the x86_64 version
15 darwin-x86_64 = fetchurl {
16 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-intel-qt6.dmg";
17 sha256 = "sha256-kus59Z9Oe4sbAlF4szeg751hlSEUR0ijKz4rjfHEWgA=";
19 darwin-aarch64 = fetchurl {
20 url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-mac-apple-qt6.dmg";
21 sha256 = "sha256-ROIpGB3W21ttWj+cRkf0rpLFrO4LR6+ZyGRsalz5J+E=";
25 unpacked = stdenv.mkDerivation {
26 inherit pname version;
28 nativeBuildInputs = [ zstd ];
39 PREFIX=$out bash install.sh
46 inherit (anki.meta) license homepage description longDescription;
47 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
48 maintainers = with maintainers; [ atemu ];
51 passthru = { inherit sources; };
54 if stdenv.isLinux then buildFHSUserEnv (appimageTools.defaultFhsEnvArgs // {
57 # Dependencies of anki
58 targetPkgs = pkgs: (with pkgs; [ xorg.libxkbfile krb5 ]);
60 runScript = writeShellScript "anki-wrapper.sh" ''
61 exec ${unpacked}/bin/anki
64 extraInstallCommands = ''
66 cp -R ${unpacked}/share/applications \
67 ${unpacked}/share/man \
68 ${unpacked}/share/pixmaps \
72 inherit meta passthru;
73 }) else stdenv.mkDerivation {
74 inherit pname version passthru;
76 src = if stdenv.isAarch64 then sources.darwin-aarch64 else sources.darwin-x86_64;
78 nativeBuildInputs = [ undmg ];
82 mkdir -p $out/Applications/
83 cp -a Anki.app $out/Applications/