Upgrade Anki version.

main
Joshua Potter 2024-01-31 07:13:42 -07:00
parent 45f3a76e72
commit fef7e8294b
3 changed files with 68 additions and 16 deletions

View File

@ -57,7 +57,7 @@
users.jrpotter = { pkgs, ... }: { users.jrpotter = { pkgs, ... }: {
imports = [ imports = [
../../users/jrpotter ../../users/jrpotter
../../users/jrpotter/anki.nix ../../users/jrpotter/anki
]; ];
dconf.settings = { dconf.settings = {

View File

@ -0,0 +1,63 @@
{ pkgs, lib, commandLineArgs ? [] }:
let
pname = "anki-bin";
version = "23.12.1";
linux = pkgs.fetchurl {
url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux-qt6.tar.zst";
sha256 = "sha256-Kv0SH+bLnBSM/tYHe2kEJc4n7izZTBNWQs2nm/teLEU=";
};
unpacked = pkgs.stdenv.mkDerivation {
inherit pname version;
nativeBuildInputs = [ pkgs.zstd ];
src = pkgs.fetchurl {
url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux-qt6.tar.zst";
sha256 = "sha256-Kv0SH+bLnBSM/tYHe2kEJc4n7izZTBNWQs2nm/teLEU=";
};
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; {
inherit (pkgs.anki.meta) license homepage description longDescription;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ mahmoudk1000 ];
};
in
pkgs.buildFHSEnv (pkgs.appimageTools.defaultFhsEnvArgs // {
inherit pname version;
name = null; # Appimage sets it to "appimage-env"
targetPkgs = pkgs: (with pkgs; [
xorg.libxkbfile
xcb-util-cursor-HEAD
krb5
]);
runScript = pkgs.writeShellScript "anki-wrapper.sh" ''
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;
})

View File

@ -1,15 +1,7 @@
{ pkgs, ... }: { pkgs, lib, ... }:
let let
addons = id: "Anki2/addons21/${toString id}"; addons = id: "Anki2/addons21/${toString id}";
FlexibleGrading = pkgs.fetchFromGitHub {
owner = "jrpotter";
repo = "FlexibleGrading";
rev = "d9cd06bbb154a0740518e58e4619d3855e22c027";
hash = "sha256-ciIVFyt7TDBeC+h5feA5I17Ld1Pge/hRDqGMMcLTJiM=";
fetchSubmodules = true;
};
anki-connect = pkgs.stdenv.mkDerivation { anki-connect = pkgs.stdenv.mkDerivation {
name = "anki-connect"; name = "anki-connect";
src = pkgs.fetchFromGitea { src = pkgs.fetchFromGitea {
@ -69,11 +61,6 @@ let
in in
{ {
xdg.dataFile = { xdg.dataFile = {
"${addons 1715096333}" = {
source = FlexibleGrading;
recursive = true; # Let's addon write to directory.
};
"${addons 2055492159}".source = "${addons 2055492159}".source =
anki-connect; anki-connect;
@ -84,5 +71,7 @@ in
syntax-highlighting-ng; syntax-highlighting-ng;
}; };
home.packages = [ pkgs.anki-bin ]; home.packages = [
(import ./anki-bin.nix { inherit pkgs lib; })
];
} }