Compare commits
2 Commits
45f3a76e72
...
2a7751c5d4
Author | SHA1 | Date |
---|---|---|
Joshua Potter | 2a7751c5d4 | |
Joshua Potter | fef7e8294b |
|
@ -57,7 +57,7 @@
|
|||
users.jrpotter = { pkgs, ... }: {
|
||||
imports = [
|
||||
../../users/jrpotter
|
||||
../../users/jrpotter/anki.nix
|
||||
../../users/jrpotter/anki
|
||||
];
|
||||
|
||||
dconf.settings = {
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
{ 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-bFtAUqSoFS8CWESiepWXywndkijATbWp6CJdqlQecuk=";
|
||||
};
|
||||
|
||||
unpacked = pkgs.stdenv.mkDerivation {
|
||||
inherit pname version;
|
||||
|
||||
nativeBuildInputs = [ pkgs.zstd ];
|
||||
src = linux;
|
||||
|
||||
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;
|
||||
})
|
|
@ -1,15 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
let
|
||||
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 {
|
||||
name = "anki-connect";
|
||||
src = pkgs.fetchFromGitea {
|
||||
|
@ -68,21 +60,14 @@ let
|
|||
};
|
||||
in
|
||||
{
|
||||
# When deleting a plugin also remove the generated folder at
|
||||
# `$HOME/.local/share/Anki2/addons21`.
|
||||
xdg.dataFile = {
|
||||
"${addons 1715096333}" = {
|
||||
source = FlexibleGrading;
|
||||
recursive = true; # Let's addon write to directory.
|
||||
"${addons 2055492159}".source = anki-connect;
|
||||
"${addons 566351439}".source = syntax-highlighting-ng;
|
||||
};
|
||||
|
||||
"${addons 2055492159}".source =
|
||||
anki-connect;
|
||||
|
||||
"${addons 1374772155}".source =
|
||||
"${image-occlusion-enhanced}/src/image_occlusion_enhanced";
|
||||
|
||||
"${addons 566351439}".source =
|
||||
syntax-highlighting-ng;
|
||||
};
|
||||
|
||||
home.packages = [ pkgs.anki-bin ];
|
||||
home.packages = [
|
||||
(import ./anki-bin.nix { inherit pkgs lib; })
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue