Declarative Nix and Home Manager modules for coding agents, MCP servers, hooks, and skills on Linux (x86_64-linux, aarch64-linux) and macOS (aarch64-darwin).
Add agents-nix to your flake inputs, import agents-nix.homeModules.default (or an individual module from homeModules), and enable the clients you use. Every assistant and peripheral tool is disabled by default, and every individual module imports homeModules.shared with deduplication.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
home-manager = {
url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
agents-nix = {
url = "github:hakulab/agents.nix";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
};
outputs =
{
nixpkgs,
home-manager,
agents-nix,
...
}:
{
homeConfigurations.dev = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
agents-nix.homeModules.default
{
home = {
username = "dev";
homeDirectory = "/home/dev";
stateVersion = "26.05";
};
agents.claude-code.enable = true;
}
];
};
};
}Supply each secret as a runtime file path string, such as "/run/secrets/api-key". Literal environment values and HTTP headers in your Nix configuration are written to the Nix store.
For clients that support authentication profiles, use config.agents.resolved.clientProfiles.<client> to select a default profile. The read-only map applies the client's allowlists and API restrictions before generating client-specific files.
See flake.nix for exported outputs, modules/home/ for available modules and option definitions, and packages/ for companion packages. Prompts, instructions, skills, and helper scripts live as plain files under assets/ and scripts/ for browsing or adapting outside Nix, while the Nix modules expand @placeholder@ tokens and wrap scripts at build time.
Input flakes' nixConfig is not inherited. Configure the binary cache in your root flake:
nixConfig = {
extra-substituters = [ "https://hakula.cachix.org" ];
extra-trusted-public-keys = [
"hakula.cachix.org-1:7zwB3fhMfReHdOjh6DmnaLXgqbPDBcojvN9F+osZw0k="
];
};For NixOS or nix-darwin, place the same settings under nix.settings according to your host's trust policy.
See AGENTS.md for contributor rules and verification commands, and RELEASING.md for the release contract.
Copyright (c) 2026 Hakula. Licensed under the MIT License.