diff options
| author | Franck Cuny <franck@fcuny.net> | 2025-06-12 13:08:07 -0700 |
|---|---|---|
| committer | Franck Cuny <franck@fcuny.net> | 2025-06-12 13:08:07 -0700 |
| commit | 0751adcc370dd121d179b51f90bf8fac02a076c1 (patch) | |
| tree | 20ceb943d47a67b44212557b899b8205ce711ce7 /nix | |
| parent | remove one of my keys from the secrets (diff) | |
| download | infra-0751adcc370dd121d179b51f90bf8fac02a076c1.tar.gz | |
simplify how we're managing templates for `llm`
Add the variable `configPath` to home-manager, to map directly to the
top level configuration of the current user (`./configs/users/$user').
Add a function to generate the mapping for all the templates we need
for the `llm` CLI.
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/lib/mkSystem.nix | 1 | ||||
| -rw-r--r-- | nix/users/fcuny/llm.nix | 28 |
2 files changed, 20 insertions, 9 deletions
diff --git a/nix/lib/mkSystem.nix b/nix/lib/mkSystem.nix index 3241dd9..94d1b35 100644 --- a/nix/lib/mkSystem.nix +++ b/nix/lib/mkSystem.nix @@ -54,6 +54,7 @@ systemFunc rec { }; home-manager.extraSpecialArgs = { inherit self inputs; + configPath = "${self}/configs/users/${user}"; }; } diff --git a/nix/users/fcuny/llm.nix b/nix/users/fcuny/llm.nix index 0c6c072..2793373 100644 --- a/nix/users/fcuny/llm.nix +++ b/nix/users/fcuny/llm.nix @@ -1,13 +1,23 @@ -{ self, ... }: { - home.file.".config/llm/templates/pr-prompt.yaml".text = - builtins.readFile "${self}/configs/llm/templates/pr-prompt.yaml"; - - home.file.".config/llm/templates/commit-prompt.yaml".text = - builtins.readFile "${self}/configs/llm/templates/commit-prompt.yaml"; - - home.file.".config/llm/templates/readme-gen.yaml".text = - builtins.readFile "${self}/configs/llm/templates/readme-gen.yaml"; + configPath, + lib, + ... +}: +let + basePath = "llm/templates"; + llmTemplates = [ + "pr-prompt.yaml" + "commit-prompt.yaml" + "readme-gen.yaml" + ]; + mkLlmTemplate = file: { + ".config/${basePath}/${file}" = { + source = "${configPath}/${basePath}/${file}"; + }; + }; +in +{ + home.file = lib.mkMerge (map mkLlmTemplate llmTemplates); programs.fish = { shellAliases = { |
