From 78ece60890c99f7e8ee7f22ee1edf15eefd96400 Mon Sep 17 00:00:00 2001 From: Nikita Pedorich Date: Wed, 24 Jan 2024 08:21:24 +0100 Subject: [PATCH] tealdeer: add cache update activation script Calls 'tldr --update' on home-manager switch --- modules/programs/tealdeer.nix | 5 +++++ tests/default.nix | 1 + tests/modules/programs/tealdeer/default-settings.nix | 12 ++++++++++++ tests/modules/programs/tealdeer/default.nix | 1 + 4 files changed, 19 insertions(+) create mode 100644 tests/modules/programs/tealdeer/default-settings.nix create mode 100644 tests/modules/programs/tealdeer/default.nix diff --git a/modules/programs/tealdeer.nix b/modules/programs/tealdeer.nix index f0e610c2d..08ba9d3f3 100644 --- a/modules/programs/tealdeer.nix +++ b/modules/programs/tealdeer.nix @@ -49,5 +49,10 @@ in { home.file."${configDir}/tealdeer/config.toml" = mkIf (cfg.settings != { }) { 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 + ''; }; } diff --git a/tests/default.nix b/tests/default.nix index 17e78d914..b3e963bbd 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -140,6 +140,7 @@ in import nmtSrc { ./modules/programs/ssh ./modules/programs/starship ./modules/programs/taskwarrior + ./modules/programs/tealdeer ./modules/programs/texlive ./modules/programs/thefuck ./modules/programs/tmate diff --git a/tests/modules/programs/tealdeer/default-settings.nix b/tests/modules/programs/tealdeer/default-settings.nix new file mode 100644 index 000000000..0044ca8f3 --- /dev/null +++ b/tests/modules/programs/tealdeer/default-settings.nix @@ -0,0 +1,12 @@ +{ config, ... }: { + config = { + programs.tealdeer = { + package = config.lib.test.mkStubPackage { name = "tldr"; }; + enable = true; + }; + + nmt.script = '' + assertFileRegex activate '/nix/store/.*tealdeer.*/bin/tldr --update' + ''; + }; +} diff --git a/tests/modules/programs/tealdeer/default.nix b/tests/modules/programs/tealdeer/default.nix new file mode 100644 index 000000000..e9deed939 --- /dev/null +++ b/tests/modules/programs/tealdeer/default.nix @@ -0,0 +1 @@ +{ tealdeer-default-settings = ./default-settings.nix; }