From 12e5ec30afcdf7d06f938fbab305644186cf3ccf Mon Sep 17 00:00:00 2001 From: WHC Date: Sat, 19 Sep 2026 18:59:14 +0800 Subject: [PATCH] Add KiCad, SPlayer, and fixed official OpenCode binary. Replace broken nixpkgs opencode with upstream linux-x64 release to avoid SystemPrompt.environment crashes. --- README.md | 7 ++++-- modules/apps.nix | 8 ++++++- pkgs/opencode-bin.nix | 50 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 pkgs/opencode-bin.nix diff --git a/README.md b/README.md index b464304..b03c8e8 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,12 @@ modules/ nvidia.nix # RTX 4060(12700F 无核显) gaming.nix # Steam printing.nix # CUPS + HP ULD + 中文打印 - apps.nix # QQ/微信包装、开发工具等 + apps.nix # QQ/微信包装、开发工具、KiCad、SPlayer、opencode 等 fpga.nix # 高云 FPGA(Gowin EDU IDE + 开源工具链) -pkgs/hp-uld-driver.nix +pkgs/ + hp-uld-driver.nix + gowin-eda-edu-ide/ # 高云教育版 IDE(FHS) + opencode-bin.nix # 官方 opencode 二进制(规避 nixpkgs 崩溃) ``` ## 目标机安装(摘要) diff --git a/modules/apps.nix b/modules/apps.nix index 9727354..4e2b055 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -142,7 +142,13 @@ in fzf btop - opencode + # EDA / 媒体 + kicad + splayer-next + + # 官方二进制:nixpkgs 版发 prompt 会崩(SystemPrompt.environment) + (callPackage ../pkgs/opencode-bin.nix { }) + bun # opencode 插件安装需要 cursor-cli ]; } diff --git a/pkgs/opencode-bin.nix b/pkgs/opencode-bin.nix new file mode 100644 index 0000000..04f547a --- /dev/null +++ b/pkgs/opencode-bin.nix @@ -0,0 +1,50 @@ +# 官方预编译二进制:nixpkgs 用新版 bun 构建的 opencode 会在发 prompt 时 +# 触发 SystemPrompt.environment 崩溃(Unexpected server error / a.name)。 +{ + lib, + stdenv, + fetchurl, + autoPatchelfHook, + makeWrapper, + ripgrep, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "opencode"; + version = "1.18.31"; + + src = fetchurl { + url = "https://github.com/anomalyco/opencode/releases/download/v${finalAttrs.version}/opencode-linux-x64.tar.gz"; + hash = "sha256-6TEr517YA7dBX8Kuq9ofT+k4kSo5Zzdi3Aw4wOEeveQ="; + }; + + nativeBuildInputs = [ + autoPatchelfHook + makeWrapper + ]; + + buildInputs = [ stdenv.cc.cc.lib ]; + + sourceRoot = "."; + + dontStrip = true; + + installPhase = '' + runHook preInstall + install -Dm755 opencode $out/bin/.opencode-wrapped + makeWrapper $out/bin/.opencode-wrapped $out/bin/opencode \ + --prefix PATH : ${lib.makeBinPath [ ripgrep ]} \ + --set OPENCODE_DISABLE_AUTOUPDATE true + runHook postInstall + ''; + + meta = { + description = "AI coding agent built for the terminal (official binary; nixpkgs build is broken)"; + homepage = "https://github.com/anomalyco/opencode"; + changelog = "https://github.com/anomalyco/opencode/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.mit; + platforms = [ "x86_64-linux" ]; + mainProgram = "opencode"; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + }; +})