{
description = "agent-environments example: several logins and several environments";
inputs = {
# In your own flake: github:<owner>/agent-environments
agent-environments.url = "path:../..";
nixpkgs.follows = "agent-environments/nixpkgs";
};
outputs =
{ agent-environments, nixpkgs, ... }:
let
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
inherit (agent-environments.lib) mkEnvironment;
# Shared by both environments.
common = {
claude.enable = true;
instructions.common.text = ''
Always run the test suite before claiming a task is done.
'';
};
in
{
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
# One environment, three launchers. Each launcher id gets its own state
# dir (~/.local/agent-environments/<id>), so each one logs in separately.
main = mkEnvironment {
inherit pkgs;
modules = [
common
{
codex.enable = true;
launchers = {
claude-work-acc.agent = "claude";
claude-pers-acc.agent = "claude";
codex-work-acc.agent = "codex";
};
}
];
};
# A different set of modules with its own launcher and login.
review = mkEnvironment {
inherit pkgs;
modules = [
common
{
instructions.review = {
order = 2000;
text = "You only review code. Never edit files.";
};
claude.settings.permissions.deny = [
"Edit"
"Write"
];
launchers.claude-review.agent = "claude";
}
];
};
in
{
main = main.package;
review = review.package;
default = pkgs.symlinkJoin {
name = "agent-environments";
paths = [
main.package
review.package
];
};
}
);
};
}