152 lines
3.8 KiB
Nix
152 lines
3.8 KiB
Nix
{
|
|
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib) optionals;
|
|
settings = {
|
|
"$schema" = "https://json.schemastore.org/claude-code-settings.json";
|
|
|
|
env = {
|
|
CLAUDE_BASH_NO_LOGIN = "1";
|
|
CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING = "1";
|
|
CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY = "1";
|
|
CLAUDE_CODE_DISABLE_TERMINAL_TITLE = "1";
|
|
CLAUDE_CODE_EAGER_FLUSH = "1";
|
|
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS = "1";
|
|
CLAUDE_CODE_FORCE_GLOBAL_CACHE = "1";
|
|
CLAUDE_CODE_HIDE_ACCOUNT_INFO = "1";
|
|
CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY = "20";
|
|
CLAUDE_CODE_PLAN_V2_AGENT_COUNT = "5";
|
|
CLAUDE_CODE_PLAN_V2_EXPLORE_AGENT_COUNT = "5";
|
|
DISABLE_AUTO_COMPACT = "1";
|
|
DISABLE_AUTOUPDATER = "1";
|
|
DISABLE_COST_WARNINGS = "1";
|
|
DISABLE_ERROR_REPORTING = "1";
|
|
DISABLE_INSTALLATION_CHECKS = "1";
|
|
DISABLE_TELEMETRY = "1";
|
|
ENABLE_MCP_LARGE_OUTPUT_FILES = "1";
|
|
ENABLE_TOOL_SEARCH = "auto:5";
|
|
MAX_THINKING_TOKENS = "31999";
|
|
MCP_CONNECTION_NONBLOCKING = "1";
|
|
UV_THREADPOOL_SIZE = "16";
|
|
};
|
|
|
|
attribution = {
|
|
commit = "";
|
|
pr = "";
|
|
};
|
|
|
|
permissions = {
|
|
allow = [
|
|
"Read"
|
|
];
|
|
defaultMode = "bypassPermissions";
|
|
};
|
|
|
|
statusLine = {
|
|
type = "command";
|
|
command = "/etc/claude/statusline-command.nu";
|
|
};
|
|
|
|
enabledPlugins = {
|
|
"clangd-lsp@claude-plugins-official" = true;
|
|
"rust-analyzer-lsp@claude-plugins-official" = true;
|
|
"context7@claude-plugins-official" = true;
|
|
"code-review@claude-plugins-official" = true;
|
|
"linear@claude-plugins-official" = true;
|
|
};
|
|
|
|
skipWebFetchPreflight = true;
|
|
|
|
spinnerVerbs = {
|
|
mode = "replace";
|
|
verbs = [
|
|
"Redeeming"
|
|
"Clodding"
|
|
"Tokenmaxxing"
|
|
"Slopping"
|
|
"Clanking"
|
|
"Churning"
|
|
"Forgetting"
|
|
"Splurging"
|
|
"Ignoring GPL"
|
|
"Increasing ram prices"
|
|
];
|
|
};
|
|
|
|
cleanupPeriodDays = 90;
|
|
alwaysThinkingEnabled = true;
|
|
remoteControlAtStartup = true;
|
|
showClearContextOnPlanAccept = true;
|
|
skipDangerousModePermissionPrompt = true;
|
|
};
|
|
|
|
settingsJson = pkgs.writeText "claude-settings.json" (builtins.toJSON settings);
|
|
|
|
runtimeDeps = lib.makeBinPath ([
|
|
pkgs.bash
|
|
pkgs.procps
|
|
pkgs.ripgrep
|
|
pkgs.bubblewrap
|
|
pkgs.socat
|
|
]);
|
|
|
|
patchScript = pkgs.writeScript "patch-claude-src" ''
|
|
#!${pkgs.python3}/bin/python3
|
|
${builtins.readFile ./patch-claude-src.py}
|
|
'';
|
|
|
|
liftScript = pkgs.writeScript "lift-claude-bun" ''
|
|
#!${pkgs.python3}/bin/python3
|
|
${builtins.readFile ./lift-claude-bun.py}
|
|
'';
|
|
|
|
externalPackageJson = pkgs.writeText "claude-code-external-package.json" (
|
|
builtins.toJSON {
|
|
name = "claude-code-lifted";
|
|
type = "commonjs";
|
|
dependencies = {
|
|
ws = "^8";
|
|
undici = "^6";
|
|
node-fetch = "^3";
|
|
ajv = "^8";
|
|
ajv-formats = "^3";
|
|
yaml = "^2";
|
|
};
|
|
}
|
|
);
|
|
|
|
mkClod =
|
|
suffix:
|
|
let
|
|
finalSuffix = "-${suffix}";
|
|
in
|
|
pkgs.writeScriptBin "claude${finalSuffix}" ''
|
|
#!${pkgs.nushell}/bin/nu --no-config-file
|
|
|
|
$env._SETTINGS_JSON = "${settingsJson}"
|
|
$env._DENO = "${pkgs.deno}/bin/deno"
|
|
$env._PATCH_SCRIPT = "${patchScript}"
|
|
$env._LIFT_SCRIPT = "${liftScript}"
|
|
$env._EXTERNAL_PACKAGE_JSON = "${externalPackageJson}"
|
|
$env._TAR = "${pkgs.gnutar}/bin/tar"
|
|
$env._RUNTIME_DEPS = "${runtimeDeps}"
|
|
$env._ENV_JSON = ${lib.strings.toJSON settings.env}
|
|
$env.CLAUDE_CONFIG_DIR = ("~/.claude${finalSuffix}" | path expand)
|
|
|
|
${builtins.readFile ./launcher.nu}
|
|
'';
|
|
in
|
|
{
|
|
environment.systemPackages = [
|
|
(mkClod "lillis")
|
|
(mkClod "amaan")
|
|
];
|
|
|
|
environment.etc."claude/statusline-command.nu".source = ./statusline-command.nu;
|
|
|
|
programs.nix-ld.enable = true;
|
|
}
|