anki: add module (#7274)
This commit is contained in:
parent
57d1027e1e
commit
e8da7372fd
6 changed files with 679 additions and 0 deletions
7
tests/modules/programs/anki/default.nix
Normal file
7
tests/modules/programs/anki/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
# Anki is currently marked as broken on Darwin (2025/06/23)
|
||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
anki-minimal-config = ./minimal-config.nix;
|
||||
anki-full-config = ./full-config.nix;
|
||||
}
|
||||
57
tests/modules/programs/anki/full-config.nix
Normal file
57
tests/modules/programs/anki/full-config.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
# This would normally not be a file in the store for security reasons.
|
||||
testPasswordFile = pkgs.writeText "test-password-file" "password";
|
||||
in
|
||||
{
|
||||
programs.anki = {
|
||||
enable = true;
|
||||
addons = [ pkgs.ankiAddons.passfail2 ];
|
||||
answerKeys = [
|
||||
{
|
||||
ease = 1;
|
||||
key = "left";
|
||||
}
|
||||
{
|
||||
ease = 2;
|
||||
key = "up";
|
||||
}
|
||||
];
|
||||
hideBottomBar = true;
|
||||
hideBottomBarMode = "fullscreen";
|
||||
hideTopBar = false;
|
||||
hideTopBarMode = "always";
|
||||
language = "en_US";
|
||||
legacyImportExport = false;
|
||||
minimalistMode = true;
|
||||
reduceMotion = true;
|
||||
spacebarRatesCard = true;
|
||||
style = "native";
|
||||
theme = "dark";
|
||||
uiScale = 1.0;
|
||||
videoDriver = "opengl";
|
||||
sync = {
|
||||
autoSync = true;
|
||||
syncMedia = true;
|
||||
autoSyncMediaMinutes = 15;
|
||||
networkTimeout = 60;
|
||||
url = "http://example.com/anki-sync/";
|
||||
username = "lovelearning@email.com";
|
||||
passwordFile = testPasswordFile;
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script =
|
||||
let
|
||||
ankiBaseDir =
|
||||
if pkgs.stdenv.hostPlatform.isDarwin then
|
||||
"home-files/Library/Application Support/Anki2"
|
||||
else
|
||||
"home-files/.local/share/Anki2";
|
||||
in
|
||||
''
|
||||
assertFileExists "${ankiBaseDir}/prefs21.db"
|
||||
|
||||
assertFileExists "${ankiBaseDir}/gldriver6"
|
||||
'';
|
||||
}
|
||||
18
tests/modules/programs/anki/minimal-config.nix
Normal file
18
tests/modules/programs/anki/minimal-config.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.anki = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
nmt.script =
|
||||
let
|
||||
ankiBaseDir =
|
||||
if pkgs.stdenv.hostPlatform.isDarwin then
|
||||
"home-files/Library/Application Support/Anki2"
|
||||
else
|
||||
"home-files/.local/share/Anki2";
|
||||
in
|
||||
''
|
||||
assertFileExists "${ankiBaseDir}/prefs21.db"
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue