Skip to content

Repository files navigation

prime-agent.nix

Options

A Nix flake for Prime Agent, a self-improving RLM agent for coding and long-running autonomous work.

It provides:

  • packages for nix run and nix build
  • a default npm-built package and an optional Bun-built variant
  • NixOS and Home Manager modules
  • an overlay exposing pkgs.prime-agent and pkgs.prime-agent-bun
  • lib.mkAgent for constructing a configured wrapper
  • automatic stable-release and dependency-lock updates

Important

This is an unofficial Nix flake and is not maintained by Prime Intellect.

Quick start

nix run github:lukasl-dev/prime-agent.nix --accept-flake-config

Or build either implementation locally:

nix build .#prime-agent --accept-flake-config
nix build .#prime-agent-bun --accept-flake-config

The package includes Node.js, Git, SSH, ripgrep, fd, and uv in its runtime path. Prime Agent uses uv for the one-time provisioning of its persistent IPython kernel under ~/.prime/agent/kernel-venv.

Usage

{
  inputs.prime-agent.url = "github:lukasl-dev/prime-agent.nix";
}

NixOS

{ inputs, config, ... }:
{
  imports = [ inputs.prime-agent.nixosModules.default ];

  programs.prime-agent = {
    enable = true;
    # rules = ''Be concise.'';
    # skills = [ ./skills ];
    # extensions = [ ./extensions/my-extension.ts ];
    # themes = [ ./themes/custom.json ];
    # promptTemplates = [ ./prompts ];
    # models = ./models.json;
    # settings.defaultProvider = "openai";
    # settings.defaultModel = "gpt-5";
    # jail.enable = true;
    # extraArgs = [ "--provider" "openai" "--model" "gpt-5" ];
    # environment.OPENAI_API_KEY.file = config.sops.secrets.openai-api-key.path;
  };
}

Home Manager

{ inputs, config, ... }:
{
  imports = [ inputs.prime-agent.homeModules.default ];

  programs.prime-agent = {
    enable = true;
    settings.defaultProvider = "openai";
    settings.defaultModel = "gpt-5";
    environment.PRIME_AGENT_CODING_AGENT_DIR.value =
      "${config.home.homeDirectory}/.prime/agent";
  };
}

Skills

Pass the common skills/ directory rather than its individual skill directories:

programs.prime-agent.skills = [ ./skills ];

Each immediate child remains a correctly named skill directory, for example skills/github/SKILL.md with name: github. Do not instead use [ ./skills/github ./skills/zig ]: Nix materializes each path separately as a store path such as /nix/store/<hash>-github, and Prime Agent then rejects the skill because its declared name no longer matches its parent directory name.

Overlay

{ inputs, ... }:
{
  nixpkgs.overlays = [ inputs.prime-agent.overlays.default ];
  environment.systemPackages = [ pkgs.prime-agent ];
}

Custom package

{ inputs, pkgs, ... }:
let
  agent = inputs.prime-agent.lib.mkAgent {
    inherit pkgs;
    modules = [{
      prime-agent = {
        rules = ''Be concise.'';
        skills = [ ./skills ];
      };
    }];
  };
in
agent.package

Jail

On Linux, Prime Agent can run in a jail.nix bubblewrap sandbox:

programs.prime-agent.jail.enable = true;

The default jail permits network access and mounts the invocation's working directory read-write. It also retains ~/.prime/agent, the configured PRIME_AGENT_CODING_AGENT_DIR, and Prime Agent's daemon socket state, allowing the daemon and IPython kernel to survive invocations. Files referenced by environment.*.file are mounted read-only automatically. Other home files and host tools remain unavailable unless explicitly exposed.

programs.prime-agent.jail.permissions = combinators: with combinators; [
  network
  mount-cwd
  (add-pkg-deps [ pkgs.gnumake pkgs.python3 ])
  (try-readonly (noescape "~/.gitconfig"))
];

Selecting the Bun package

programs.prime-agent.package =
  inputs.prime-agent.packages.${pkgs.system}.prime-agent-bun;

Options

Generate the complete option reference in Markdown or HTML:

nix build .#docs-md
nix build .#docs-html

The output is available at result/index.md or result/index.html.

About

Nix flake for Prime Intellect's prime-agent, a terminal coding agent.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages