anki: support multiple profiles

This commit is contained in:
sollniss 2026-01-07 23:28:50 +09:00 committed by Austin Horstman
parent bff85cb66b
commit 04acdd8af8
3 changed files with 241 additions and 138 deletions

View file

@ -1,7 +1,8 @@
{ pkgs, ... }:
let
# This would normally not be a file in the store for security reasons.
testKeyFile = pkgs.writeText "test-key-file" "a-sync-key";
fooKeyFile = pkgs.writeText "foo-key-file" "a-sync-key";
barKeyFile = pkgs.writeText "bar-key-file" "a-sync-key";
in
{
programs.anki = {
@ -30,14 +31,30 @@ in
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";
keyFile = testKeyFile;
profiles = {
foo = {
default = true;
sync = {
autoSync = true;
syncMedia = true;
autoSyncMediaMinutes = 15;
networkTimeout = 60;
url = "http://foo.com/anki-sync/";
username = "foo@email.com";
keyFile = fooKeyFile;
};
};
bar = {
sync = {
autoSync = false;
syncMedia = false;
autoSyncMediaMinutes = 30;
networkTimeout = 120;
url = "http://foo.com/anki-sync/";
username = "bar@email.com";
keyFile = barKeyFile;
};
};
};
};