simplify claude code module
This commit is contained in:
parent
1c122e36dc
commit
88f037a5aa
2 changed files with 5 additions and 38 deletions
|
|
@ -24,11 +24,6 @@
|
||||||
|
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
# Claude Code configuration
|
|
||||||
programs.claude-code-custom = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# nixOS-specific alias
|
# nixOS-specific alias
|
||||||
programs.zsh.shellAliases = {
|
programs.zsh.shellAliases = {
|
||||||
oss = "sudo nixos-rebuild switch --flake ~/.config/nix#$(hostname)";
|
oss = "sudo nixos-rebuild switch --flake ~/.config/nix#$(hostname)";
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.programs.claude-code-custom;
|
|
||||||
|
|
||||||
# Detect system architecture and select appropriate package
|
# Detect system architecture and select appropriate package
|
||||||
claudePackage = if pkgs.system == "aarch64-darwin" then
|
claudePackage = if pkgs.system == "aarch64-darwin" then
|
||||||
claude-code.packages.aarch64-darwin.claude-code
|
claude-code.packages.aarch64-darwin.claude-code
|
||||||
|
|
@ -167,36 +165,10 @@ let
|
||||||
autoCompactEnabled = true;
|
autoCompactEnabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Global permissions configuration
|
|
||||||
globalPermissions = if cfg.permissions != null then cfg.permissions else defaultPermissions;
|
|
||||||
|
|
||||||
# Default global memory content
|
|
||||||
defaultGlobalMemory = ''
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Global memory configuration
|
|
||||||
globalMemoryContent = if cfg.globalMemory != null then cfg.globalMemory else defaultGlobalMemory;
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options.programs.claude-code-custom = {
|
config = {
|
||||||
enable = mkEnableOption "Claude Code AI assistant";
|
|
||||||
|
|
||||||
permissions = mkOption {
|
|
||||||
type = types.nullOr (types.attrsOf (types.listOf types.str));
|
|
||||||
default = null;
|
|
||||||
description = "Global permissions configuration. If null, uses default permissions.";
|
|
||||||
};
|
|
||||||
|
|
||||||
globalMemory = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = null;
|
|
||||||
description = "Global memory configuration for Claude Code. Content for ~/.claude/CLAUDE.md file. If null, uses default global memory.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
# Install Claude Code package
|
# Install Claude Code package
|
||||||
home.packages = [ claudePackage ];
|
home.packages = [ claudePackage ];
|
||||||
|
|
||||||
|
|
@ -205,14 +177,14 @@ in
|
||||||
text = builtins.toJSON globalSettings;
|
text = builtins.toJSON globalSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Create global permissions file (optional, can be overridden per project)
|
# Create global permissions file
|
||||||
home.file.".claude/permissions.json" = {
|
home.file.".claude/permissions.json" = {
|
||||||
text = builtins.toJSON { permissions = globalPermissions; };
|
text = builtins.toJSON { permissions = defaultPermissions; };
|
||||||
};
|
};
|
||||||
|
|
||||||
# Create global memory file (always created with default or custom content)
|
# Create global memory file
|
||||||
home.file.".claude/CLAUDE.md" = {
|
home.file.".claude/CLAUDE.md" = {
|
||||||
text = globalMemoryContent;
|
text = "";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue