From 9cfc57d6a605466ed9a359abcaee86b4ec9f62e0 Mon Sep 17 00:00:00 2001 From: Luis Eduardo Bueso de Barrio Date: Tue, 3 Feb 2026 10:21:11 +0100 Subject: [PATCH] first commit --- flake.lock | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 22 ++++--- 2 files changed, 187 insertions(+), 7 deletions(-) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..72443dc --- /dev/null +++ b/flake.lock @@ -0,0 +1,172 @@ +{ + "nodes": { + "blueprint": { + "inputs": { + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ], + "systems": "systems_2" + }, + "locked": { + "lastModified": 1769353768, + "narHash": "sha256-zI+7cbMI4wMIR57jMjDSEsVb3grapTnURDxxJPYFIW0=", + "owner": "numtide", + "repo": "blueprint", + "rev": "c7da5c70ad1c9b60b6f5d4f674fbe205d48d8f6c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "blueprint", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "jail-nix": { + "locked": { + "lastModified": 1765903853, + "narHash": "sha256-buoPpx7moJzAXbLuHAImn6x9fGRdk3x0T57goPv1vnc=", + "owner": "~alexdavid", + "repo": "jail.nix", + "rev": "bf9f49c8118e7a77b68a675dbe26e93e91412066", + "type": "sourcehut" + }, + "original": { + "owner": "~alexdavid", + "repo": "jail.nix", + "type": "sourcehut" + } + }, + "llm-agents": { + "inputs": { + "blueprint": "blueprint", + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1769813338, + "narHash": "sha256-IlRKon8+bfoi/uOa8CUPAAWW0Pv6AHBSF1jVSD4QO8U=", + "owner": "numtide", + "repo": "llm-agents.nix", + "rev": "58939415e56d01c30d429cf0c49a9d8e2a6a07c3", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "llm-agents.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1769740369, + "narHash": "sha256-xKPyJoMoXfXpDM5DFDZDsi9PHArf2k5BJjvReYXoFpM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6308c3b21396534d8aaeac46179c14c439a89b8a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1769461804, + "narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bfc1b8a4574108ceef22f02bafcf6611380c100d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "jail-nix": "jail-nix", + "llm-agents": "llm-agents", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1769691507, + "narHash": "sha256-8aAYwyVzSSwIhP2glDhw/G0i5+wOrren3v6WmxkVonM=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "28b19c5844cc6e2257801d43f2772a4b4c050a1b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 05be1ef..2e300b3 100644 --- a/flake.nix +++ b/flake.nix @@ -73,17 +73,25 @@ name = "opencode"; pkg = opencodePkg; }; + + claudePkg = llm-agents.packages.${system}.claude; + + claude-jailed = makeJailedAgent { + name = "claude"; + pkg = claudePkg; + }; in { packages = { - inherit opencode-jailed; + inherit opencode-jailed claude-jailed; }; lib = { - # Call as: inputs.jailed-agents.lib.makeJailedOpencode system { extraPkgs = [...]; } - makeJailedOpencode = + # Call as: inputs.jailed-agents.lib.makeJailed system { extraPkgs = [...]; } + makeJailed = system': { + agentTool, extraPkgs ? [ ], extraCombinators ? [ ], }: @@ -92,7 +100,7 @@ jail' = jail-nix.lib.init pkgs'; pkg' = llm-agents.packages.${system'}.opencode; in - jail' "opencode" pkg' ( + jail' agentTool pkg' ( with jail'.combinators; ( [ @@ -100,9 +108,9 @@ time-zone no-new-session mount-cwd - (readwrite (noescape "~/.config/opencode")) - (readwrite (noescape "~/.local/share/opencode")) - (readwrite (noescape "~/.local/state/opencode")) + (readwrite (noescape "~/.config/${agentTool}")) + (readwrite (noescape "~/.local/share/${agentTool}")) + (readwrite (noescape "~/.local/state/${agentTool}")) (add-pkg-deps ( with pkgs'; [