From d634c3abafa454551f2083b054cd95c3f287be61 Mon Sep 17 00:00:00 2001 From: Carl Hjerpe Date: Sun, 28 Jan 2024 21:18:29 +0100 Subject: [PATCH] tealdeer: add option to toggle update on activation This is a network operation that can take awhile if you're on a shitty connection. --- modules/programs/tealdeer.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/programs/tealdeer.nix b/modules/programs/tealdeer.nix index 08ba9d3f3..3f03c715f 100644 --- a/modules/programs/tealdeer.nix +++ b/modules/programs/tealdeer.nix @@ -17,6 +17,14 @@ in { options.programs.tealdeer = { enable = mkEnableOption "Tealdeer"; + updateOnActivation = mkOption { + type = with types; bool; + default = true; + description = '' + Whether to update tealdeer's cache on activation. + ''; + }; + settings = mkOption { type = tomlFormat.type; default = { }; @@ -50,9 +58,11 @@ in { source = tomlFormat.generate "tealdeer-config" cfg.settings; }; - home.activation.tealdeerCache = hm.dag.entryAfter [ "linkGeneration" ] '' - $VERBOSE_ECHO "Rebuilding tealdeer cache" - $DRY_RUN_CMD ${getExe pkgs.tealdeer} --update - ''; + home.activation = mkIf cfg.updateOnActivation { + tealdeerCache = hm.dag.entryAfter [ "linkGeneration" ] '' + $VERBOSE_ECHO "Rebuilding tealdeer cache" + $DRY_RUN_CMD ${getExe pkgs.tealdeer} --update + ''; + }; }; }