From e09c0784da143da39c8e7f9519babe7c0fa049be Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 27 May 2026 14:41:25 -0700 Subject: [PATCH] update: opencode --- home/profiles/opencode/default.nix | 14 ------ hosts/box/default.nix | 4 -- hosts/curve/default.nix | 4 -- hosts/darwin/default.nix | 52 ++++++++++------------ hosts/profiles/opencode-server/default.nix | 1 - secrets/secrets.nix | 13 ------ 6 files changed, 24 insertions(+), 64 deletions(-) diff --git a/home/profiles/opencode/default.nix b/home/profiles/opencode/default.nix index 26ddb85..f07e20a 100644 --- a/home/profiles/opencode/default.nix +++ b/home/profiles/opencode/default.nix @@ -13,8 +13,6 @@ in let # Paths to agenix-decrypted secrets (same on Darwin and NixOS) githubToken = "/run/agenix/github-token"; - anthropicToken = "/run/agenix/anthropicToken"; - openaiToken = "/run/agenix/openaiToken"; # github-mcp-server binary path from nixpkgs githubMcpServer = "${pkgs.github-mcp-server}/bin/github-mcp-server"; @@ -81,18 +79,6 @@ in permission = { external_directory = "allow"; }; - provider = { - anthropic = { - options = { - apiKey = "{file:${anthropicToken}}"; - }; - }; - openai = { - options = { - apiKey = "{file:${openaiToken}}"; - }; - }; - }; mcp = { github = { type = "local"; diff --git a/hosts/box/default.nix b/hosts/box/default.nix index 3a47404..d54e854 100644 --- a/hosts/box/default.nix +++ b/hosts/box/default.nix @@ -92,10 +92,6 @@ age.secrets.borg-key.file = "${self}/secrets/borg-key.age"; age.secrets.github-token.file = "${self}/secrets/github-token.age"; age.secrets.github-token.owner = "anish"; - age.secrets.anthropicToken.file = "${self}/secrets/anthropicToken.age"; - age.secrets.anthropicToken.owner = "anish"; - age.secrets.openaiToken.file = "${self}/secrets/openaiToken.age"; - age.secrets.openaiToken.owner = "anish"; mossnet.wg = { enable = true; ips = [ "10.0.69.4/24" ]; diff --git a/hosts/curve/default.nix b/hosts/curve/default.nix index 9ee76d2..4ef37b2 100644 --- a/hosts/curve/default.nix +++ b/hosts/curve/default.nix @@ -112,10 +112,6 @@ age.secrets.curve-wg.owner = "anish"; age.secrets.github-token.file = "${self}/secrets/github-token.age"; age.secrets.github-token.owner = "anish"; - age.secrets.anthropicToken.file = "${self}/secrets/anthropicToken.age"; - age.secrets.anthropicToken.owner = "anish"; - age.secrets.openaiToken.file = "${self}/secrets/openaiToken.age"; - age.secrets.openaiToken.owner = "anish"; mossnet.wg = { enable = true; diff --git a/hosts/darwin/default.nix b/hosts/darwin/default.nix index f100ec3..d7394bf 100644 --- a/hosts/darwin/default.nix +++ b/hosts/darwin/default.nix @@ -35,40 +35,36 @@ in age.secrets.work-wg.owner = "anishlakhwara"; age.secrets.github-token.file = "${self}/secrets/github-token.age"; age.secrets.github-token.owner = "anishlakhwara"; - age.secrets.anthropicToken.file = "${self}/secrets/anthropicToken.age"; - age.secrets.anthropicToken.owner = "anishlakhwara"; - age.secrets.openaiToken.file = "${self}/secrets/openaiToken.age"; - age.secrets.openaiToken.owner = "anishlakhwara"; # Maintain a marked block in /etc/hosts pointing mossnet.lan hostnames at the # LAN IP for the box. Needed because nix-darwin lacks networking.extraHosts / # networking.hosts, and because the corporate ScoutDNS agent (127.0.0.1:53) does # not resolve .lan names, breaking browser access despite /etc/resolver entries. system.activationScripts.extraActivation.text = '' - set -eu - hosts_file=/etc/hosts - begin_marker='# >>> mossnet hosts (managed by nix-darwin) >>>' - end_marker='# <<< mossnet hosts (managed by nix-darwin) <<<' - desired=$(cat <<'EOF' -${mossnetHostsBlock} -EOF -) - - tmp=$(/usr/bin/mktemp) - # Strip any existing block, then append the fresh one. - /usr/bin/sed "/$begin_marker/,/$end_marker/d" "$hosts_file" > "$tmp" - # Trim trailing blank lines from the stripped output so we get clean spacing. - /usr/bin/awk 'BEGIN{blank=0} /^$/{blank++; next} {for(i=0;i "$tmp.compact" - { - cat "$tmp.compact" - printf '\n%s\n%s\n%s\n' "$begin_marker" "$desired" "$end_marker" - } > "$hosts_file.new" - /bin/chmod 644 "$hosts_file.new" - /usr/sbin/chown root:wheel "$hosts_file.new" - /bin/mv "$hosts_file.new" "$hosts_file" - /bin/rm -f "$tmp" "$tmp.compact" - /usr/bin/dscacheutil -flushcache || true - /usr/bin/killall -HUP mDNSResponder 2>/dev/null || true + set -eu + hosts_file=/etc/hosts + begin_marker='# >>> mossnet hosts (managed by nix-darwin) >>>' + end_marker='# <<< mossnet hosts (managed by nix-darwin) <<<' + desired=$(cat <<'EOF' + ${mossnetHostsBlock} + EOF + ) + + tmp=$(/usr/bin/mktemp) + # Strip any existing block, then append the fresh one. + /usr/bin/sed "/$begin_marker/,/$end_marker/d" "$hosts_file" > "$tmp" + # Trim trailing blank lines from the stripped output so we get clean spacing. + /usr/bin/awk 'BEGIN{blank=0} /^$/{blank++; next} {for(i=0;i "$tmp.compact" + { + cat "$tmp.compact" + printf '\n%s\n%s\n%s\n' "$begin_marker" "$desired" "$end_marker" + } > "$hosts_file.new" + /bin/chmod 644 "$hosts_file.new" + /usr/sbin/chown root:wheel "$hosts_file.new" + /bin/mv "$hosts_file.new" "$hosts_file" + /bin/rm -f "$tmp" "$tmp.compact" + /usr/bin/dscacheutil -flushcache || true + /usr/bin/killall -HUP mDNSResponder 2>/dev/null || true ''; networking.wg-quick.interfaces = { diff --git a/hosts/profiles/opencode-server/default.nix b/hosts/profiles/opencode-server/default.nix index 53825a6..26565b4 100644 --- a/hosts/profiles/opencode-server/default.nix +++ b/hosts/profiles/opencode-server/default.nix @@ -17,7 +17,6 @@ in # Read the API key from the agenix secret file and export it script = '' - export ANTHROPIC_API_KEY="$(cat /run/agenix/anthropicToken)" exec ${opencode}/bin/opencode serve --port 4096 --hostname 0.0.0.0 ''; diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 70e7465..c5d9a12 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -75,19 +75,6 @@ in system mossnet ]; - "anthropicToken.age".publicKeys = [ - work - user - system - mossnet - ]; - - "openaiToken.age".publicKeys = [ - work - user - system - mossnet - ]; # Radicle node keys "radicle-box-key.age".publicKeys = [ mossnet ]; -- 2.51.2