refactor: move gemini api key to secret

This commit is contained in:
Mohammad Rafiq 2025-03-30 05:05:22 +08:00
parent 00c219cb05
commit 9ee5317e6a
No known key found for this signature in database
5 changed files with 34 additions and 8 deletions

21
configs/shell/aichat.nix Normal file
View file

@ -0,0 +1,21 @@
{ pkgs, ... }:
{
home-manager.users.rafiq = {
home.shellAliases = {
ai = "aichat -r %shell% -e";
};
home.packages = with pkgs; [
aichat
];
xdg.configFile."aichat/config.yaml" = {
text = ''
model: gemini:gemini-2.0-flash
clients:
- type: gemini
'';
};
};
}

View file

@ -1,7 +1,8 @@
{ pkgs, ... }:
{ pkgs, config, ... }:
{
imports = [
./scripts
./aichat.nix
./comma.nix
./direnv.nix
./editorconfig.nix
@ -17,11 +18,17 @@
./zsh.nix
];
environment.shellInit = # sh
''
export CWP_JIRA_LINK=$(sudo cat ${config.sops.secrets.cwp_jira_link.path})
export CWP_JIRA_PAT=$(sudo cat ${config.sops.secrets.cwp_jira_pat.path})
export GEMINI_API_KEY=$(sudo cat ${config.sops.secrets.gemini_api_key.path})
'';
home-manager.users.rafiq.home = {
shell.enableShellIntegration = true;
shellAliases = {
gs = "git status";
ai = "aichat -r %shell% -e";
cd = "z";
v = "$EDITOR";
g = "git";
@ -30,7 +37,6 @@
};
packages = with pkgs; [
aichat
bat
btop # add settings as home-manager module
devenv

View file

@ -22,9 +22,6 @@
''
# Bind CTRL+Backspace to delete whole word
bindkey '^H' backward-kill-word
export CWP_JIRA_LINK_FILE="${config.sops.secrets.cwp_jira_link.path}"
export CWP_JIRA_PAT_FILE="${config.sops.secrets.cwp_jira_pat.path}"
'';
# TODO: Look into whether we need to add the history attribute
profileExtra = # bash