2024-02-02 16:47:19 +00:00
|
|
|
{ fetchurl
|
|
|
|
, stdenv
|
|
|
|
, lib
|
|
|
|
, buildFHSEnv
|
|
|
|
, appimageTools
|
|
|
|
, writeShellScript
|
|
|
|
, anki
|
|
|
|
, zstd
|
|
|
|
, commandLineArgs ? []
|
|
|
|
}:
|
2024-01-31 14:13:42 +00:00
|
|
|
let
|
|
|
|
pname = "anki-bin";
|
|
|
|
version = "23.12.1";
|
|
|
|
|
2024-02-02 16:47:19 +00:00
|
|
|
linux = fetchurl {
|
2024-01-31 14:13:42 +00:00
|
|
|
url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux-qt6.tar.zst";
|
2024-01-31 14:30:26 +00:00
|
|
|
sha256 = "sha256-bFtAUqSoFS8CWESiepWXywndkijATbWp6CJdqlQecuk=";
|
2024-01-31 14:13:42 +00:00
|
|
|
};
|
|
|
|
|
2024-02-02 16:47:19 +00:00
|
|
|
unpacked = stdenv.mkDerivation {
|
2024-01-31 14:13:42 +00:00
|
|
|
inherit pname version;
|
|
|
|
|
2024-02-02 16:47:19 +00:00
|
|
|
nativeBuildInputs = [ zstd ];
|
2024-01-31 14:30:26 +00:00
|
|
|
src = linux;
|
2024-01-31 14:13:42 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
xdg-mime () {
|
|
|
|
echo Stubbed!
|
|
|
|
}
|
|
|
|
export -f xdg-mime
|
|
|
|
PREFIX=$out bash install.sh
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
passthru.sources = { inherit linux; };
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-02-02 16:47:19 +00:00
|
|
|
inherit (anki.meta) license homepage description longDescription;
|
2024-01-31 14:13:42 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
maintainers = with maintainers; [ mahmoudk1000 ];
|
|
|
|
};
|
|
|
|
in
|
2024-02-02 16:47:19 +00:00
|
|
|
buildFHSEnv (appimageTools.defaultFhsEnvArgs // {
|
2024-01-31 14:13:42 +00:00
|
|
|
inherit pname version;
|
|
|
|
name = null; # Appimage sets it to "appimage-env"
|
|
|
|
|
|
|
|
targetPkgs = pkgs: (with pkgs; [
|
|
|
|
xorg.libxkbfile
|
|
|
|
xcb-util-cursor-HEAD
|
|
|
|
krb5
|
|
|
|
]);
|
|
|
|
|
2024-02-02 16:47:19 +00:00
|
|
|
runScript = writeShellScript "anki-wrapper.sh" ''
|
2024-01-31 14:13:42 +00:00
|
|
|
exec ${unpacked}/bin/anki ${ lib.strings.escapeShellArgs commandLineArgs } "$@"
|
|
|
|
'';
|
|
|
|
|
|
|
|
extraInstallCommands = ''
|
|
|
|
ln -s ${pname} $out/bin/anki
|
|
|
|
mkdir -p $out/share
|
|
|
|
cp -R ${unpacked}/share/applications \
|
|
|
|
${unpacked}/share/man \
|
|
|
|
${unpacked}/share/pixmaps \
|
|
|
|
$out/share/
|
|
|
|
'';
|
|
|
|
|
|
|
|
inherit meta passthru;
|
|
|
|
})
|