From 9f6e703c9e1c75d976b474f5173f831f9af9f6f9 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Sat, 29 Mar 2025 10:26:42 +0100 Subject: [PATCH] feat(goose-cli): add package and update configurations - Added `goose-cli` package definition and metadata in `unstable` overlay. - Updated `default.nix` under `aarch64-darwin` to include `goose-cli` in system packages. - Removed commented out packages and cleaned up unused lines for better clarity and maintainability. --- overlays/unstable/default.nix | 2 +- overlays/unstable/goose.nix | 80 +++++++++++++++++++++++++++ systems/aarch64-darwin/m4/default.nix | 5 +- 3 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 overlays/unstable/goose.nix diff --git a/overlays/unstable/default.nix b/overlays/unstable/default.nix index b858186..130f452 100644 --- a/overlays/unstable/default.nix +++ b/overlays/unstable/default.nix @@ -5,7 +5,7 @@ final: prev: { ollama open-webui claude-code - goose-cli aider-chat ; + goose-cli = channels.unstable.callPackage ./goose.nix { }; } diff --git a/overlays/unstable/goose.nix b/overlays/unstable/goose.nix new file mode 100644 index 0000000..2b0e759 --- /dev/null +++ b/overlays/unstable/goose.nix @@ -0,0 +1,80 @@ +{ lib +, stdenv +, fetchFromGitHub +, fetchurl +, rustPlatform +, dbus +, xorg +, pkg-config +, writableTmpDirAsHomeHook +, nix-update-script +, llvmPackages +, +}: +let + gpt-4o-tokenizer = fetchurl { + url = "https://huggingface.co/Xenova/gpt-4o/resolve/31376962e96831b948abe05d420160d0793a65a4/tokenizer.json"; + hash = "sha256-Q6OtRhimqTj4wmFBVOoQwxrVOmLVaDrgsOYTNXXO8H4="; + meta.license = lib.licenses.unfree; + }; + claude-tokenizer = fetchurl { + url = "https://huggingface.co/Xenova/claude-tokenizer/resolve/cae688821ea05490de49a6d3faa36468a4672fad/tokenizer.json"; + hash = "sha256-wkFzffJLTn98mvT9zuKaDKkD3LKIqLdTvDRqMJKRF2c="; + meta.license = lib.licenses.unfree; + }; +in +rustPlatform.buildRustPackage rec { + pname = "goose-cli"; + version = "1.0.16"; + + src = fetchFromGitHub { + owner = "block"; + repo = "goose"; + tag = "v${version}"; + hash = "sha256-fwywPX+tmfECno7x7cCExc2SoASZ6XzOzaVciMBkiBk="; + }; + + useFetchCargoVendor = true; + cargoHash = "sha256-Gu+mMFzOkswTbm1AygkaZynW7c+9vHZHTMFUNMWWiEg="; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ dbus ] ++ lib.optionals stdenv.hostPlatform.isLinux [ xorg.libxcb ]; + + env.LIBCLANG_PATH = "${lib.getLib llvmPackages.libclang}/lib"; + + preBuild = '' + mkdir -p tokenizer_files/Xenova--gpt-4o tokenizer_files/Xenova--claude-tokenizer + ln -s ${gpt-4o-tokenizer} tokenizer_files/Xenova--gpt-4o/tokenizer.json + ln -s ${claude-tokenizer} tokenizer_files/Xenova--claude-tokenizer/tokenizer.json + ''; + + nativeCheckInputs = [ writableTmpDirAsHomeHook ]; + + __darwinAllowLocalNetworking = true; + + checkFlags = + [ + # need dbus-daemon + "--skip=config::base::tests::test_multiple_secrets" + "--skip=config::base::tests::test_secret_management" + # Observer should be Some with both init project keys set + "--skip=tracing::langfuse_layer::tests::test_create_langfuse_observer" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # Lazy instance has previously been poisoned + "--skip=jetbrains::tests::test_capabilities" + "--skip=jetbrains::tests::test_router_creation" + ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Open-source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM"; + homepage = "https://github.com/block/goose"; + mainProgram = "goose"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ cloudripper ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +} diff --git a/systems/aarch64-darwin/m4/default.nix b/systems/aarch64-darwin/m4/default.nix index dbf1e87..96f4e3b 100644 --- a/systems/aarch64-darwin/m4/default.nix +++ b/systems/aarch64-darwin/m4/default.nix @@ -2,7 +2,6 @@ with lib.metacfg; { - homebrew = { enable = true; brews = [ @@ -29,8 +28,6 @@ with lib.metacfg; }; environment.systemPackages = with pkgs; [ - # iterm2 - # azure-cli kubectl kubectx k9s @@ -44,6 +41,8 @@ with lib.metacfg; qemu claude-code nodejs + goose-cli + aider-chat ]; users.users.harald.shell = pkgs.fish;