Running nixpkgs-update (https://github.com/NixOS/infra/blob/main/non-critical-infra/modules/nixpkgs-update/README.md) with UPDATE_INFO: opencode 2.2.1 -> 2.2.5 https://github.com/anomalyco/opencode/releases attrpath: opencode Checking auto update branch... [version] [version] skipping because derivation has updateScript [rustCrateVersion] [rustCrateVersion] No cargoHash found [golangModuleVersion] [golangModuleVersion] Not a buildGoModule package with vendorHash [npmDepsVersion] [npmDepsVersion] No npmDepsHash [updateScript] [updateScript] Success [updateScript] this derivation will be built: /nix/store/14r9gjc84x9zwbg507859354jsklfn6m-packages.json.drv building '/nix/store/14r9gjc84x9zwbg507859354jsklfn6m-packages.json.drv'... structuredAttrs is enabled Going to be running update for following packages: - opencode-2.2.1 Press Enter key to continue... Running update for: Enqueuing group of 1 packages - opencode-2.2.1: UPDATING ... - opencode-2.2.1: DONE. Packages updated! Diff after rewrites: diff --git a/pkgs/by-name/op/opencode/package.nix b/pkgs/by-name/op/opencode/package.nix index e4aa363c7f8a..be9421f9bc12 100644 --- a/pkgs/by-name/op/opencode/package.nix +++ b/pkgs/by-name/op/opencode/package.nix @@ -77,13 +77,13 @@ let # NOTE: Required else we get errors that our fixed-output derivation references store paths dontFixup = true; - outputHash = "sha256-BLDp8UTu3BEX5sH4RjtGZi5PfQB08Z4dozDNURJ1h9g="; + outputHash = "sha256-xfOVcw1+waLVNhFDwzOtzxrUSQEogvn88YomydOlhwc="; outputHashMode = "recursive"; }; in stdenv.mkDerivation (finalAttrs: { pname = "opencode"; - version = "2.2.1"; + version = "2.2.5"; __structuredAttrs = true; strictDeps = true; @@ -92,7 +92,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "anomalyco"; repo = "opencode"; tag = "v${finalAttrs.version}"; - hash = "sha256-7SMutix/nhKC+JgAVq6TbrGLZwqbB+6wSKzTBzLmN1o="; + hash = "sha256-/a1czcXi12KWPXcESqplNdOZcjEs8gWCMO7w4nQYLkw="; }; postPatch = No auto update branch exists Old version 2.2.1" not present in master derivation file with contents: { lib, stdenv, bun, darwin, fetchFromGitHub, installShellFiles, makeBinaryWrapper, models-dev, nodejs, nix-update-script, ripgrep, sysctl, versionCheckHook, wayland, writableTmpDirAsHomeHook, }: let node_modules = finalAttrs: stdenv.mkDerivation { pname = "${finalAttrs.pname}-node_modules"; inherit (finalAttrs) version src; __structuredAttrs = true; strictDeps = true; impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [ "GIT_PROXY_COMMAND" "SOCKS_SERVER" ]; nativeBuildInputs = [ bun writableTmpDirAsHomeHook ]; dontConfigure = true; buildPhase = '' runHook preBuild export BUN_INSTALL_CACHE_DIR=$(mktemp -d) bun install \ --cpu="*" \ --filter './' \ --filter './packages/cli' \ --filter './packages/desktop' \ --filter './packages/app' \ --frozen-lockfile \ --ignore-scripts \ --no-progress \ --os="*" bun --bun ./nix/scripts/canonicalize-node-modules.ts bun --bun ./nix/scripts/normalize-bun-binaries.ts runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p $out find . -type d -name node_modules -exec cp -R --parents {} $out \; # opencode targets only Linux and Darwin (see meta.platforms), so the # Windows executables that "bun install --os=*" fetches are never # executed. Dropping them keeps the output reproducible on hosts whose # security endpoint agents scan the store, and removes the vulnerable # bundled 7za.exe that will be quarantined. find $out -type f -name '*.exe' -delete runHook postInstall ''; # NOTE: Required else we get errors that our fixed-output derivation references store paths dontFixup = true; outputHash = "sha256-xfOVcw1+waLVNhFDwzOtzxrUSQEogvn88YomydOlhwc="; outputHashMode = "recursive"; }; in stdenv.mkDerivation (finalAttrs: { pname = "opencode"; version = "2.2.5"; __structuredAttrs = true; strictDeps = true; src = fetchFromGitHub { owner = "anomalyco"; repo = "opencode"; tag = "v${finalAttrs.version}"; hash = "sha256-/a1czcXi12KWPXcESqplNdOZcjEs8gWCMO7w4nQYLkw="; }; postPatch = # Relax Bun version check to be a warning instead of an error '' substituteInPlace packages/script/src/index.ts \ --replace-fail \ 'throw new Error(`This script requires bun@''${expectedBunVersionRange}' \ 'console.warn(`Warning: This script requires bun@''${expectedBunVersionRange}' '' # Avoid requiring prettier just to format the schema JSON + '' substituteInPlace packages/cli/script/schema.ts \ --replace-fail 'import { format } from "prettier"' 'const format = (s: string) => JSON.stringify(JSON.parse(s), null, 2)' ''; node_modules = node_modules finalAttrs; nativeBuildInputs = [ bun installShellFiles makeBinaryWrapper nodejs writableTmpDirAsHomeHook ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.autoSignDarwinBinariesHook ]; env = { MODELS_DEV_API_JSON = "${models-dev}/dist/_api.json"; OPENCODE_DISABLE_MODELS_FETCH = true; OPENCODE_VERSION = finalAttrs.version; OPENCODE_CHANNEL = "latest"; NODE_OPTIONS = "--max-old-space-size=4096"; }; configurePhase = '' runHook preConfigure cp -R "$node_modules"/. . patchShebangs node_modules patchShebangs packages/*/node_modules runHook postConfigure ''; buildPhase = '' runHook preBuild cd ./packages/cli bun --bun ./script/build.ts --single --skip-install bun --bun ./script/schema.ts cli.json bun --bun ../schema/script/config-schema.ts config.json runHook postBuild ''; installPhase = '' runHook preInstall install -Dm755 dist/cli-*/bin/opencode $out/bin/opencode wrapArgs=( --set OPENCODE_DISABLE_AUTOUPDATE true --suffix PATH : ${lib.makeBinPath [ ripgrep ]} ) ${lib.optionalString stdenv.hostPlatform.isDarwin '' wrapArgs+=(--prefix PATH : ${lib.makeBinPath [ sysctl ]}) ''} ${lib.optionalString stdenv.hostPlatform.isLinux '' wrapArgs+=(--prefix LD_LIBRARY_PATH : ${ lib.makeLibraryPath [ stdenv.cc.cc wayland ] }) ''} wrapProgram $out/bin/opencode "''${wrapArgs[@]}" install -Dm644 cli.json $out/share/cli.json install -Dm644 config.json $out/share/config.json install -Dm644 ../web/public/theme.json $out/share/theme.json runHook postInstall ''; postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd opencode \ --bash <($out/bin/opencode --completions bash) \ --zsh <($out/bin/opencode --completions zsh) \ --fish <($out/bin/opencode --completions fish) ''; dontStrip = true; nativeInstallCheckInputs = [ versionCheckHook writableTmpDirAsHomeHook ]; doInstallCheck = true; versionCheckKeepEnvironment = [ "HOME" "OPENCODE_DISABLE_MODELS_FETCH" ]; versionCheckProgramArg = "--version"; passthru = { jsonschema = { cli = "${finalAttrs.finalPackage}/share/cli.json"; config = "${finalAttrs.finalPackage}/share/config.json"; theme = "${finalAttrs.finalPackage}/share/theme.json"; }; updateScript = nix-update-script { extraArgs = [ "--subpackage" "node_modules" ]; }; }; meta = { description = "AI coding agent built for the terminal"; homepage = "https://github.com/anomalyco/opencode"; changelog = "https://github.com/anomalyco/opencode/releases/tag/v${finalAttrs.version}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ delafthi DuskyElf graham33 xiaoxiangmoe ]; sourceProvenance = with lib.sourceTypes; [ fromSource ]; platforms = [ "aarch64-linux" "x86_64-linux" "aarch64-darwin" ]; mainProgram = "opencode"; }; })