From 7c29f2df877a83c5e860d3a98ff96e1b2caeb05c Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Mon, 12 May 2025 11:36:05 +0300 Subject: [PATCH] nongnu: Add aichat. * nongnu/packages/ai.scm: New file. * nongnu/packages/ai.scm (aichat): New variable. --- nongnu/packages/ai.scm | 102 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 nongnu/packages/ai.scm diff --git a/nongnu/packages/ai.scm b/nongnu/packages/ai.scm new file mode 100644 index 00000000..c496e8f9 --- /dev/null +++ b/nongnu/packages/ai.scm @@ -0,0 +1,102 @@ +;;; SPDX-License-Identifier: GPL-3.0-or-later +;;; Copyright © 2025 Oleg Pykhalov + +(define-module (nongnu packages ai) + #:use-module (guix build-system copy) + #:use-module (guix download) + #:use-module (guix git-download) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module ((guix licenses) :prefix license:) + #:use-module (ice-9 match)) + +(define-public aichat + (package + (name "aichat") + (version "0.29.0") + (source + (let ((arch (match (or (%current-target-system) (%current-system)) + ("aarch64-linux" "aarch64-unknown-linux") + ("i686-linux" "i686-unknown-linux") + ("x86_64-linux" "x86_64-unknown-linux"))) + (hash (match (or (%current-target-system) (%current-system)) + ("aarch64-linux" + "0cb7hw6ylgx20b9vk8cg5i2kvixm2656sk89lj40p1shph5blay9") + ("i686-linux" + "0sqfq0pxgy57kk5gm2rr8pw1mihg2rinc1hh16nb690abzbpz3nx") + ("x86_64-linux" + "1v6ssw8f8v7lvqvibhm50pvpyzbzrlkbrkdgz2chplylmklkajsp")))) + (origin (method url-fetch) + (uri (string-append + "https://github.com/sigoden/aichat/releases/download/v" + version "/aichat-v0.29.0-" arch "-musl.tar.gz")) + (sha256 + (base32 hash))))) + (build-system copy-build-system) + (inputs + `(("aichat-source" + ,(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/sigoden/aichat") + (commit (string-append "v" version)))) + (sha256 + (base32 + "1lzjg5d6d8dw4w6qbwfh4d0xfnx03lxwymdda5ihn16739yxkxg5")))))) + (arguments + (list + #:substitutable? #f + #:install-plan + #~'(("aichat" "bin/")) + #:phases + #~(modify-phases %standard-phases + (replace 'unpack + (lambda* (#:key source #:allow-other-keys) + (invoke "tar" "-xvf" source))) + (add-after 'install 'install-extra-files + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (share-airchat (string-append out "/share/aichat")) + (bash-completion + (string-append out "/etc/bash_completion.d")) + (fish-functions + (string-append out "/share/fish/vendor_functions.d")) + (nu-completion + (string-append out "/share/nu/completions")) + (powershell-completion + (string-append out "/share/powershell/completions")) + (zsh-completion + (string-append out "/share/zsh/site-functions"))) + (with-directory-excursion (assoc-ref inputs "aichat-source") + (mkdir-p share-airchat) + (for-each (lambda (file) + (copy-file + (string-append "scripts/shell-integration/" + file) + (string-append share-airchat "/" file))) + '("integration.bash" + "integration.fish" + "integration.nu" + "integration.ps1" + "integration.zsh")) + (mkdir-p bash-completion) + (copy-file "scripts/completions/aichat.bash" + (string-append bash-completion "/aichat")) + (mkdir-p fish-functions) + (copy-file "scripts/completions/aichat.fish" + (string-append fish-functions "/aichat.fish")) + (mkdir-p nu-completion) + (copy-file "scripts/completions/aichat.nu" + (string-append nu-completion "/aichat.nu")) + (mkdir-p powershell-completion) + (copy-file "scripts/completions/aichat.ps1" + (string-append powershell-completion "/aichat.ps1")) + (mkdir-p zsh-completion) + (copy-file "scripts/completions/aichat.zsh" + (string-append zsh-completion "/_aichat"))))))))) + (home-page "https://github.com/sigoden/aichat") + (supported-systems '("aarch64-linux" "i686-linux" "x86_64-linux")) + (synopsis "LLMs in the terminal") + (description "All-in-one AI CLI tool featuring Chat-REPL, Shell Assistant, + RAG, AI tools and agents.") + (license license:asl2.0)))