1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

anki: rename sync.passwordFile, improve documentation

The account password is different from the sync key needed here. Add
instructions for how to get the sync key, and make the option name
accurate.
This commit is contained in:
June Stepp 2025-09-23 10:40:17 -05:00 committed by Austin Horstman
parent f5852ea36c
commit 131f4e22c3
3 changed files with 25 additions and 5 deletions

View file

@ -17,6 +17,13 @@ in
{
meta.maintainers = [ lib.maintainers.junestepp ];
imports = [
(lib.mkRenamedOptionModule
[ "programs" "anki" "sync" "passwordFile" ]
[ "programs" "anki" "sync" "keyFile" ]
)
];
options.programs.anki = {
enable = lib.mkEnableOption "Anki";
@ -208,10 +215,23 @@ in
description = "Path to a file containing the sync account username.";
};
passwordFile = lib.mkOption {
keyFile = lib.mkOption {
type = with lib.types; nullOr path;
default = null;
description = "Path to a file containing the sync account password.";
description = ''
Path to a file containing the sync account sync key. This is different from
the account password.
To get the sync key, follow these steps:
- Enable this Home Manager module: `programs.anki.enable = true`
- Open Anki.
- Navigate to the sync settings page. (Tools > Preferences > Syncing)
- Log in to your AnkiWeb account.
- Select "Yes" to the prompt about saving preferences and syncing.
- A Home Manager warning prompt will show. Select "Show details...".
- Get your sync key from the message: "syncKey changed from \`None\` to \`<YOUR SYNC KEY WILL BE HERE>\`"
'';
};
url = lib.mkOption {

View file

@ -164,7 +164,7 @@ in
if cfg.sync.usernameFile == null then "None" else "Path('${cfg.sync.usernameFile}')"
}
key_file: Path | None = ${
if cfg.sync.passwordFile == null then "None" else "Path('${cfg.sync.passwordFile}')"
if cfg.sync.keyFile == null then "None" else "Path('${cfg.sync.keyFile}')"
}
custom_sync_url: str | None = ${if cfg.sync.url == null then "None" else "'${cfg.sync.url}'"}

View file

@ -1,7 +1,7 @@
{ pkgs, ... }:
let
# This would normally not be a file in the store for security reasons.
testPasswordFile = pkgs.writeText "test-password-file" "password";
testKeyFile = pkgs.writeText "test-key-file" "a-sync-key";
in
{
programs.anki = {
@ -37,7 +37,7 @@ in
networkTimeout = 60;
url = "http://example.com/anki-sync/";
username = "lovelearning@email.com";
passwordFile = testPasswordFile;
keyFile = testKeyFile;
};
};