Skip to content

Commit de1b60c

Browse files
authored
feat(home-manager): add support for anki (#790)
1 parent b49c675 commit de1b60c

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

modules/home-manager/all-modules.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# keep-sorted start
33
./aerc.nix
44
./alacritty.nix
5+
./anki.nix
56
./atuin.nix
67
./bat.nix
78
./bottom.nix

modules/home-manager/anki.nix

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{ catppuccinLib }:
2+
{
3+
config,
4+
pkgs,
5+
lib,
6+
...
7+
}:
8+
9+
let
10+
cfg = config.catppuccin.anki;
11+
in
12+
13+
{
14+
options.catppuccin.anki = catppuccinLib.mkCatppuccinOption { name = "anki"; };
15+
16+
config = lib.mkIf cfg.enable {
17+
programs.anki = {
18+
addons = with pkgs.ankiAddons; [
19+
(recolor.withConfig {
20+
config =
21+
let
22+
polarity = if config.catppuccin.flavor == "latte" then "light" else "dark";
23+
flavor = lib.toSentenceCase config.catppuccin.flavor;
24+
version = builtins.splitVersion recolor.version;
25+
in
26+
(lib.importJSON "${recolor}/share/anki/addons/recolor/themes/(${polarity}) Catppuccin ${flavor}.json")
27+
// {
28+
version = {
29+
major = lib.toInt (builtins.elemAt version 0);
30+
minor = lib.toInt (builtins.elemAt version 1);
31+
};
32+
};
33+
})
34+
];
35+
};
36+
};
37+
}

modules/tests/home.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ in
2525
# keep-sorted start block=yes sticky_comments=yes
2626
aerc.enable = true;
2727
alacritty.enable = true;
28+
anki.enable = true;
2829
bat.enable = true;
2930
bottom.enable = true;
3031
brave.enable = true;

0 commit comments

Comments
 (0)