A Nix flake for Prime Agent, a self-improving RLM agent for coding and long-running autonomous work.
It provides:
- packages for
nix runandnix build - a default npm-built package and an optional Bun-built variant
- NixOS and Home Manager modules
- an overlay exposing
pkgs.prime-agentandpkgs.prime-agent-bun lib.mkAgentfor 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.
nix run github:lukasl-dev/prime-agent.nix --accept-flake-configOr build either implementation locally:
nix build .#prime-agent --accept-flake-config
nix build .#prime-agent-bun --accept-flake-configThe 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.
{
inputs.prime-agent.url = "github:lukasl-dev/prime-agent.nix";
}{ 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;
};
}{ 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";
};
}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.
{ inputs, ... }:
{
nixpkgs.overlays = [ inputs.prime-agent.overlays.default ];
environment.systemPackages = [ pkgs.prime-agent ];
}{ inputs, pkgs, ... }:
let
agent = inputs.prime-agent.lib.mkAgent {
inherit pkgs;
modules = [{
prime-agent = {
rules = ''Be concise.'';
skills = [ ./skills ];
};
}];
};
in
agent.packageOn 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"))
];programs.prime-agent.package =
inputs.prime-agent.packages.${pkgs.system}.prime-agent-bun;Generate the complete option reference in Markdown or HTML:
nix build .#docs-md
nix build .#docs-htmlThe output is available at result/index.md or result/index.html.