1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-09 10:31:06 +01:00

claude-code: added memories (claude.md) generation

This commit is contained in:
Sewer56 2025-08-22 21:15:09 +01:00 committed by Austin Horstman
parent 17a1004948
commit 343e555657
6 changed files with 90 additions and 0 deletions

View file

@ -156,6 +156,36 @@ in
};
};
memory = {
text = lib.mkOption {
type = lib.types.nullOr lib.types.lines;
default = null;
description = ''
Inline memory content for CLAUDE.md.
This option is mutually exclusive with memory.source.
'';
example = ''
# Project Memory
## Current Task
Implementing enhanced claude-code module for home-manager.
## Key Files
- claude-code.nix: Main module implementation
'';
};
source = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
Path to a file containing memory content for CLAUDE.md.
This option is mutually exclusive with memory.text.
'';
example = lib.literalExpression "./claude-memory.md";
};
};
mcpServers = lib.mkOption {
type = lib.types.attrsOf jsonFormat.type;
default = { };
@ -203,6 +233,10 @@ in
assertion = cfg.mcpServers == { } || cfg.package != null;
message = "`programs.claude-code.package` cannot be null when `mcpServers` is configured";
}
{
assertion = !(cfg.memory.text != null && cfg.memory.source != null);
message = "Cannot specify both `programs.claude-code.memory.text` and `programs.claude-code.memory.source`";
}
];
programs.claude-code.finalPackage =
@ -243,6 +277,10 @@ in
}
);
};
".claude/CLAUDE.md" = lib.mkIf (cfg.memory.text != null || cfg.memory.source != null) (
if cfg.memory.text != null then { text = cfg.memory.text; } else { source = cfg.memory.source; }
);
}
// lib.mapAttrs' (
name: content: