A Nix flake that packages the GitHub Copilot CLI for easy installation on NixOS and with Home Manager.
This repository provides a Nix flake that packages the GitHub Copilot CLI, allowing you to easily install and use GitHub Copilot in your terminal on NixOS systems or through Home Manager. This flake is updated weekly with the last version of Copilot.
- Nix with flakes enabled
- A GitHub account with Copilot access
- For Home Manager usage: Home Manager installed and configured
The easiest way to try the GitHub Copilot CLI is using the development shell:
# Clone this repository
git clone <repository-url>
# Enter the development shell
nix develop
# The copilot command should now be available
copilot --helpTo build the package locally:
nix buildThe built package will be available in the result symlink.
Add this flake to your NixOS system configuration:
# /etc/nixos/configuration.nix or flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
copilot-cli.url = "github:scarisey/copilot-cli-flake";
};
outputs = { self, nixpkgs, copilot-cli, ... }: {
nixosConfigurations.your-hostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; # or your system architecture
modules = [
{
environment.systemPackages = [
copilot-cli.packages.x86_64-linux.default # Adjust architecture as needed
];
}
# ... your other modules
];
};
};
}Then rebuild your system:
sudo nixos-rebuild switchIf you're using Home Manager as a standalone tool:
# ~/.config/home-manager/home.nix
{ config, pkgs, ... }:
let
copilot-cli = builtins.getFlake "github:scarisey/copilot-cli-flake";
in
{
home.packages = [
copilot-cli.packages.${pkgs.system}.default
];
# Rest of your Home Manager configuration...
}Apply the configuration:
home-manager switchIf you're using Home Manager as a NixOS module:
# /etc/nixos/configuration.nix or your flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
copilot-cli.url = "github:scarisey/copilot-cli-flake";
};
outputs = { self, nixpkgs, home-manager, copilot-cli, ... }: {
nixosConfigurations.your-hostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
{
home-manager.users.yourusername = {
home.packages = [
copilot-cli.packages.x86_64-linux.default
];
};
}
# ... your other modules
];
};
};
}For a quick one-time installation:
# Install directly from the flake
nix profile install github:scarisey/copilot-cli-flake
# Or install from a local clone
nix profile install .This flake supports the following systems:
x86_64-linuxaarch64-linuxx86_64-darwinaarch64-darwin
After installation, you'll need to authenticate with GitHub:
# Start the authentication process with Github CLI
gh auth login
# Follow the prompts to authenticate with your GitHub accountOnce installed and authenticated, you can use GitHub Copilot CLI:
# Get help
copilot --help
# Just start interactive mode
copilot
# Execute a prompt in non-interactive mode
copilot -p "Fix the bug in main.js" --allow-all-tools
To update to a newer version of the GitHub Copilot CLI:
Use update.sh script that will do the following :
- Update the
versioninpackage.nix - Update the
urlandsha256in thefetchurlcall - Update the
npmDepsHash
# Enter the development shell
nix develop
# Make changes to package.nix or flake.nix
# Test your changes
nix build
# Test the development shell
nix develop --command copilot --helpIf you get an error about flakes not being enabled, add this to your Nix configuration:
# /etc/nixos/configuration.nix
nix.settings.experimental-features = [ "nix-command" "flakes" ];Or for non-NixOS systems, add to ~/.config/nix/nix.conf:
experimental-features = nix-command flakes
If you have trouble with authentication:
- Make sure you have a GitHub account with Copilot access
- Try logging out and back in:
copilot auth logoutthencopilot auth login - Check your internet connection and GitHub's status
If the copilot command is not found after installation:
- Make sure the package is in your PATH
- Try restarting your shell or sourcing your profile
- For Home Manager users, ensure you've run
home-manager switch
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit issues or pull requests.
For more information about GitHub Copilot CLI, visit the official documentation.