From 3ca6191b1bb7a67ad542962d501d3ad61c771bc0 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Fri, 8 May 2026 15:01:44 -0700 Subject: [PATCH] clover: ai stuff, please forgive me everyone for falling into the trap --- packages/autofmt/default.nix | 22 +++++++++----------- users/clover/AGENTS.md | 1 + users/clover/home.nix | 40 +++++++++++++----------------------- users/clover/switch-admin.sh | 26 +++++++++++++++++++++++ 4 files changed, 51 insertions(+), 38 deletions(-) create mode 120000 users/clover/AGENTS.md create mode 100755 users/clover/switch-admin.sh diff --git a/packages/autofmt/default.nix b/packages/autofmt/default.nix index 82a0fe2a6a1e1133498d93c2d118e070cb25ee70..64cebfb26f07b232564e8818e4732c0663c0dbd4 100644 --- a/packages/autofmt/default.nix +++ b/packages/autofmt/default.nix @@ -11,17 +11,15 @@ let zig ]; in -pkgs.symlinkJoin { +pkgs.writeTextFile { name = "autofmt"; - paths = [ - (pkgs.writeTextFile { - name = "autofmt"; - destination = "/bin/autofmt"; - executable = true; - text = builtins.replaceStrings - [ "#!/usr/bin/env node" ] - [ "#!${pkgs.nodejs}/bin/node" ] - (builtins.readFile ./autofmt.js); - }) - ] ++ runtimeInputs; + destination = "/bin/autofmt"; + executable = true; + text = builtins.replaceStrings + [ "#!/usr/bin/env node" ] + [ + ''#!${pkgs.nodejs}/bin/node + process.env.PATH = "${pkgs.lib.makeBinPath runtimeInputs}:" + (process.env.PATH ?? "");'' + ] + (builtins.readFile ./autofmt.js); } diff --git a/users/clover/AGENTS.md b/users/clover/AGENTS.md new file mode 120000 index 0000000000000000000000000000000000000000..3c17c141dc2d1847af202b7719ec399f6237c92a --- /dev/null +++ b/users/clover/AGENTS.md @@ -0,0 +1 @@ +../../../.config/opencode/AGENTS.md \ No newline at end of file diff --git a/users/clover/home.nix b/users/clover/home.nix index 7e1dcdeefc3d3a7833cdd3c9b329ca798ff2ac41..24c202b2afc2368abc297926f9ff384894748bad 100644 --- a/users/clover/home.nix +++ b/users/clover/home.nix @@ -146,28 +146,6 @@ in fi } - function opencode() { - local image="opencode-local" - if ! docker image inspect "$image" &>/dev/null; then - echo "opencode: image not found, building..." >&2 - docker build -t "$image" "$HOME/config/files/opencode" || { echo "opencode: build failed" >&2; return 1; } - fi - docker run --rm -it \ - -v "$(pwd):$(pwd)" \ - -w "$(pwd)" \ - -v "$HOME/.config/opencode:/home/agent/.config/opencode" \ - -v "$HOME/.local/share/opencode:/home/agent/.local/share/opencode" \ - -v "$HOME/.local/state/opencode:/home/agent/.local/state/opencode" \ - -v "$HOME/.config/opencode:$HOME/.config/opencode" \ - -v "$HOME/.local/share/opencode:$HOME/.local/share/opencode" \ - -v "$HOME/.local/state/opencode:$HOME/.local/state/opencode" \ - -v "$HOME/.cache/opencode:$HOME/.cache/opencode" \ - --env-file <(env | grep '^OPENAI_\|^ANTHROPIC_\|^OPENCODE_\|^XDG_') \ - --name "opencode-$(basename $(pwd))-$$" \ - "$image" \ - opencode "$@" - } - function jj() { if [[ "$*" = "git push"* ]] && [[ "$*" != *"--dry-run"* ]]; then if command jj "$@" --dry-run; then @@ -185,6 +163,7 @@ in git = { # use a git-specific email + ignores = [ "AGENTS.md" ]; settings.user.email = "git@paperclover.net"; settings.gpg.ssh.allowedSignersFile = "${pkgs.writeText "allowed_signers" '' git@paperclover.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAVa1aq1LEj/VXHJYlR5HJpK65lS/9jOL/dAB9ZS1chd @@ -213,15 +192,19 @@ in "working_copy remote_bookmarks" = colors."working_copy bookmark"; "author" = { - fg = "white"; + fg = "bright black"; bold = false; italic = true; }; "working_copy author" = colors.author; + committer = { + fg = "bright black"; + bold = false; + }; desc = { - bold = false; - fg = "bright white"; + bold = true; + fg = "default"; }; description = colors.desc; cc_wip = { @@ -231,7 +214,7 @@ in }; cc_header = { bold = true; - fg = "bright white"; + fg = "default"; }; cc_feat = "green"; cc_fix = "red"; @@ -250,6 +233,10 @@ in bold = true; reverse = true; }; + "change_id shortest rest" = { + fg = "bright black"; + bold = true; + }; conflict_marker = { fg = "bright red"; bold = true; @@ -257,6 +244,7 @@ in }; timestamp = "bright black"; + "committer timestamp" = colors.committer; commit_id = { fg = "bright black"; bold = false; diff --git a/users/clover/switch-admin.sh b/users/clover/switch-admin.sh new file mode 100755 index 0000000000000000000000000000000000000000..5ccb8d5aa54c63541bc4c965b07c8fcb219711da --- /dev/null +++ b/users/clover/switch-admin.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -eu + +cd /Users/clo/config + +target_host="${1:-}" +if [ -z "$target_host" ]; then + if [ -f .hostname ]; then + target_host="$(cat .hostname)" + else + target_host="$(hostname)" + fi +fi + +case "$target_host" in + '' | *[!A-Za-z0-9._-]*) + printf 'invalid host: %s\n' "$target_host" >&2 + exit 2 + ;; +esac + +if [ "$(uname -s)" != Darwin ]; then + exec ./switch "$target_host" +fi + +exec osascript -e "do shell script \"cd /Users/clo/config && /nix/var/nix/profiles/default/bin/nix run .#darwin-rebuild -- switch --flake .#$target_host\" with administrator privileges" -- 2.54.0