72 lines
2.0 KiB
Nix
72 lines
2.0 KiB
Nix
{ config, pkgs, lib, inputs, ... }:
|
|
|
|
let
|
|
cfg = config.dot.llm;
|
|
in
|
|
{
|
|
options.dot.llm = {
|
|
enable = lib.mkEnableOption "LLM tools";
|
|
claude-code.enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Enable claude-code";
|
|
};
|
|
opencode.enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Enable opencode";
|
|
};
|
|
gemini-cli.enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Enable gemini-cli";
|
|
};
|
|
pi.enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Enable pi";
|
|
};
|
|
bubblewrap.enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = pkgs.stdenv.isLinux;
|
|
description = "Enable bubblewrap (Linux only)";
|
|
};
|
|
};
|
|
|
|
config = lib.mkMerge [
|
|
{
|
|
programs.direnv = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
nix-direnv.enable = true;
|
|
stdlib = ''
|
|
: ''${XDG_CACHE_HOME:=$HOME/.cache}
|
|
declare -A direnv_layout_dirs
|
|
direnv_layout_dir() {
|
|
echo "''${direnv_layout_dirs[$PWD]:=$(
|
|
echo -n "$XDG_CACHE_HOME"/direnv/layouts/
|
|
echo -n "$PWD" | sha1sum | cut -d ' ' -f 1
|
|
)}"
|
|
}
|
|
'';
|
|
};
|
|
|
|
home.packages = with pkgs; [
|
|
visidata
|
|
codespelunker
|
|
jq
|
|
inputs.hunk.packages.${pkgs.stdenv.hostPlatform.system}.hunk
|
|
];
|
|
}
|
|
|
|
(lib.mkIf cfg.enable {
|
|
home.packages =
|
|
(lib.optional cfg.claude-code.enable pkgs.unstable.claude-code) ++
|
|
(lib.optional cfg.opencode.enable pkgs.unstable.opencode) ++
|
|
(lib.optional cfg.gemini-cli.enable pkgs.unstable.gemini-cli) ++
|
|
(lib.optional cfg.pi.enable inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.pi) ++
|
|
(lib.optional (cfg.bubblewrap.enable && pkgs.stdenv.isLinux) pkgs.unstable.bubblewrap);
|
|
})
|
|
];
|
|
}
|