feat(user/malte): upgrade aichat
This commit is contained in:
parent
0ca56f3c10
commit
d22ae0cad6
|
@ -165,6 +165,24 @@ in {
|
||||||
|
|
||||||
programs.aichat = {
|
programs.aichat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = let
|
||||||
|
version = "0.18.0";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "sigoden";
|
||||||
|
repo = "aichat";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-V7WKzi9PKSek8DlF7QzBEaYn3a+BJzMtKEoi5yMGS/w=";
|
||||||
|
};
|
||||||
|
withWarning = lib.warnIf (lib.versionOlder version pkgs.aichat.version) "aichat was updated! Remove the version fix";
|
||||||
|
in
|
||||||
|
withWarning (pkgs.aichat.overrideAttrs (old: {
|
||||||
|
inherit version src;
|
||||||
|
cargoDeps = old.cargoDeps.overrideAttrs (lib.const {
|
||||||
|
inherit src;
|
||||||
|
name = "aichat-vendor.tar.gz";
|
||||||
|
outputHash = "sha256-4rwxAMK/1Vs4ynvhwCEopQNmpF1gHOg/9QeYHzmC7L0=";
|
||||||
|
});
|
||||||
|
}));
|
||||||
openaiApiKeyFile = nixosConfig.sops.secrets.openai-aichat-api-key.path;
|
openaiApiKeyFile = nixosConfig.sops.secrets.openai-aichat-api-key.path;
|
||||||
settings = {
|
settings = {
|
||||||
model = "openai:gpt-4o";
|
model = "openai:gpt-4o";
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
aichatWrapper = pkgs.writeShellApplication {
|
aichatWrapper = pkgs.writeShellApplication {
|
||||||
name = "aichat";
|
name = "aichat";
|
||||||
runtimeInputs = [pkgs.aichat];
|
runtimeInputs = [cfg.package];
|
||||||
text = ''
|
text = ''
|
||||||
OPENAI_API_KEY="$(cat ${cfg.openaiApiKeyFile})"; export OPENAI_API_KEY
|
OPENAI_API_KEY="$(cat ${cfg.openaiApiKeyFile})"; export OPENAI_API_KEY
|
||||||
${lib.getExe pkgs.aichat} "$@"
|
aichat "$@"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
in {
|
in {
|
||||||
options.programs.aichat = {
|
options.programs.aichat = {
|
||||||
enable = lib.mkEnableOption "aichat, the terminal ai interface";
|
enable = lib.mkEnableOption "aichat, the terminal ai interface";
|
||||||
|
package = lib.mkPackageOption pkgs "aichat" {};
|
||||||
openaiApiKeyFile = lib.mkOption {
|
openaiApiKeyFile = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "API key file for OpenAI";
|
description = "API key file for OpenAI";
|
||||||
|
|
Loading…
Reference in a new issue