gpt-cli icon indicating copy to clipboard operation
gpt-cli copied to clipboard

Package in Nix package manager broken

Open NoidoDev opened this issue 6 months ago • 1 comments

gpt-cli
  version: 0.4.1
  programs: gpt
  description: Command-line interface for ChatGPT, Claude and Bard
  homepage: https://github.com/kharvd/gpt-cli
  license: MIT License

This is unfortunately broken. Though, I was able to install it using pipx, which wasn't mentioned in the installation tutorial.

The short error message probably won't help much, the point is just that it doesn't work:

   … while evaluating the option `users.users.user.packages':
   … while evaluating definitions from `/etc/nixos/configuration.nix':
   (stack trace truncated; use '--show-trace' to show the full, detailed trace)
   error: undefined variable 'gpt-cli'

Partially related (backlink): https://discourse.nixos.org/t/packages-of-gpt-cli-and-gpt-box-dont-install/65503/

NoidoDev avatar Jun 18 '25 20:06 NoidoDev

I installed it through pipx and needed to do to

export OPENAI_API_KEY= ...

in my Fish shell. Now I can access it. I'm not sure if this is persistent, so I saved the key in a password manager and also added a external file to configuration.nix with the command to import the environment variables.

{ config, pkgs, ... }:
        {

        environment.sessionVariables = { 
                OPENAI_API_KEY = <KEY>

This last part has not been tested yet.

NoidoDev avatar Jun 20 '25 23:06 NoidoDev