feat(anki): add enable option

This commit is contained in:
2026-05-22 10:26:27 +02:00
parent 1158e855c2
commit 96c65fc991
4 changed files with 47 additions and 29 deletions

View File

@@ -63,6 +63,7 @@
bash.addBinToPath = true; bash.addBinToPath = true;
}; };
anki.enable = true; anki.enable = true;
anki.enable = true;
k8s.k9s.enable = true; k8s.k9s.enable = true;
taskwarrior.enable = true; taskwarrior.enable = true;
audio.enable = true; audio.enable = true;

View File

@@ -89,6 +89,7 @@
postgresql.enable = true; postgresql.enable = true;
redis.enable = true; redis.enable = true;
}; };
anki.enable = true;
k8s.enable = true; k8s.enable = true;
shell.enable = true; shell.enable = true;
my.stylix.enable = true; my.stylix.enable = true;

View File

@@ -9,9 +9,14 @@
}: }:
let let
cfg = config.anki;
sops = myUtils.sopsAvailability config osConfig; sops = myUtils.sopsAvailability config osConfig;
standalone = osConfig == null; standalone = osConfig == null;
in in
{
options.anki.enable = lib.mkEnableOption "Anki";
config = lib.mkIf cfg.enable (
lib.optionalAttrs standalone { lib.optionalAttrs standalone {
sops.secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" null { sops.secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" null {
anki = [ anki = [
@@ -22,7 +27,7 @@ lib.optionalAttrs standalone {
} }
// { // {
warnings = lib.optional ( warnings = lib.optional (
!sops.available && config.programs.anki.enable !sops.available
) "anki is enabled but sops secrets are not available. anki sync will not be configured."; ) "anki is enabled but sops secrets are not available. anki sync will not be configured.";
programs.anki = { programs.anki = {
@@ -39,3 +44,5 @@ lib.optionalAttrs standalone {
}; };
}; };
} }
);
}

View File

@@ -1,6 +1,15 @@
{ lib, config, ... }:
let
cfg = config.anki;
in
{ {
config.secrets.groups.anki = [ options.anki.enable = lib.mkEnableOption "anki";
config = lib.mkIf cfg.enable {
secrets.groups.anki = [
"sync-user" "sync-user"
"sync-key" "sync-key"
]; ];
};
} }