chore(opencode): update to v1.1.51 and refactor build configuration
- Update opencode from v1.1.48 to v1.1.51 - Refactor build dependencies: remove fzf, add sysctl conditionally for Darwin - Fix bun to use nixpkgs-unstable input instead of direct dependency - Add platform-specific outputHash for Darwin and Linux - Move wrapProgram from postFixup to installPhase - Remove unnecessary build patch and postPatch/postBuild workarounds - Fix config path to use absolute home directory - Add git and home-manager to default shell inputs - Minor README documentation reordering
This commit is contained in:
@@ -87,10 +87,8 @@ fi
|
|||||||
4. Edit file
|
4. Edit file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Ensure Config
|
|
||||||
mkdir -p ~/.config/sops/age
|
|
||||||
|
|
||||||
# Convert SSH to Age
|
# Convert SSH to Age
|
||||||
|
mkdir -p ~/.config/sops/age
|
||||||
ssh-to-age -private-key -i $HOME/.ssh/id_ed25519 -o ~/.config/sops/age/keys.txt
|
ssh-to-age -private-key -i $HOME/.ssh/id_ed25519 -o ~/.config/sops/age/keys.txt
|
||||||
|
|
||||||
# Get Public Key
|
# Get Public Key
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ in
|
|||||||
sopsFile = lib.snowfall.fs.get-file "secrets/common/evanreichard.yaml";
|
sopsFile = lib.snowfall.fs.get-file "secrets/common/evanreichard.yaml";
|
||||||
};
|
};
|
||||||
templates."opencode.json" = {
|
templates."opencode.json" = {
|
||||||
path = ".config/opencode/opencode.json";
|
path = "${config.home.homeDirectory}/.config/opencode/opencode.json";
|
||||||
content = builtins.toJSON {
|
content = builtins.toJSON {
|
||||||
"$schema" = "https://opencode.ai/config.json";
|
"$schema" = "https://opencode.ai/config.json";
|
||||||
theme = "catppuccin";
|
theme = "catppuccin";
|
||||||
|
|||||||
@@ -1,25 +1,29 @@
|
|||||||
{ lib
|
{ lib
|
||||||
|
, inputs
|
||||||
|
, system
|
||||||
, stdenvNoCC
|
, stdenvNoCC
|
||||||
, bun
|
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fzf
|
|
||||||
, makeBinaryWrapper
|
, makeBinaryWrapper
|
||||||
, models-dev
|
, models-dev
|
||||||
, nix-update-script
|
, nix-update-script
|
||||||
, ripgrep
|
, ripgrep
|
||||||
|
, sysctl
|
||||||
, installShellFiles
|
, installShellFiles
|
||||||
, versionCheckHook
|
, versionCheckHook
|
||||||
, writableTmpDirAsHomeHook
|
, writableTmpDirAsHomeHook
|
||||||
,
|
,
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
bun = inputs.nixpkgs-unstable.legacyPackages.${system}.bun;
|
||||||
|
in
|
||||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||||
pname = "opencode";
|
pname = "opencode";
|
||||||
version = "1.1.48";
|
version = "1.1.51";
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "anomalyco";
|
owner = "anomalyco";
|
||||||
repo = "opencode";
|
repo = "opencode";
|
||||||
tag = "v${finalAttrs.version}";
|
tag = "v${finalAttrs.version}";
|
||||||
hash = "sha256-zKkeJSsxEuhucQkWBHxLR7tCTu86q2p6neRST2g/1hA="; # "sha256-RTj64yrVLTFNpVc8MvPAJISOlBo/j2MnuL5jo4VtKWM=";
|
hash = "sha256-i9KR5n6bT0p7xLErlgaq2TAj/B7ZbLd9a+4Czg8q/cI=";
|
||||||
};
|
};
|
||||||
|
|
||||||
node_modules = stdenvNoCC.mkDerivation {
|
node_modules = stdenvNoCC.mkDerivation {
|
||||||
@@ -68,7 +72,11 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
|||||||
# NOTE: Required else we get errors that our fixed-output derivation references store paths
|
# NOTE: Required else we get errors that our fixed-output derivation references store paths
|
||||||
dontFixup = true;
|
dontFixup = true;
|
||||||
|
|
||||||
outputHash = "sha256-aQScGeakRanvH1LxizXrWA17YOmJJfRuypX4Jau4zQw="; # "sha256-37pmIiJzPEWeA7+5u5lz39vlFPI+N13Qw9weHrAaGW4=";
|
outputHash =
|
||||||
|
if stdenvNoCC.hostPlatform.isDarwin then
|
||||||
|
"sha256-DChoXNWJFlyyAqeiR06BQMLITwVQXy0wvQs58l0d1Xc="
|
||||||
|
else
|
||||||
|
"sha256-zkinMkPR1hCBbB5BIuqozQZDpjX4eiFXjM6lpwUx1fM=";
|
||||||
outputHashAlgo = "sha256";
|
outputHashAlgo = "sha256";
|
||||||
outputHashMode = "recursive";
|
outputHashMode = "recursive";
|
||||||
};
|
};
|
||||||
@@ -82,17 +90,9 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
|||||||
];
|
];
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
./remove-special-and-windows-build-targets.patch # NOTE: Remove special and windows build targes
|
|
||||||
./root_fix.patch # https://github.com/anomalyco/opencode/pull/7691
|
./root_fix.patch # https://github.com/anomalyco/opencode/pull/7691
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
|
||||||
# NOTE: 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}'
|
|
||||||
'';
|
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
|
||||||
@@ -105,16 +105,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
|||||||
env.OPENCODE_VERSION = finalAttrs.version;
|
env.OPENCODE_VERSION = finalAttrs.version;
|
||||||
env.OPENCODE_CHANNEL = "stable";
|
env.OPENCODE_CHANNEL = "stable";
|
||||||
|
|
||||||
preBuild = ''
|
|
||||||
chmod -R u+w ./packages/opencode/node_modules
|
|
||||||
pushd ./packages/opencode/node_modules/@opentui/
|
|
||||||
for pkg in ../../../../node_modules/.bun/@opentui+core-*; do
|
|
||||||
linkName=$(basename "$pkg" | sed 's/@.*+\(.*\)@.*/\1/')
|
|
||||||
ln -sf "$pkg/node_modules/@opentui/$linkName" "$linkName"
|
|
||||||
done
|
|
||||||
popd
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
|
||||||
@@ -129,6 +119,18 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
|||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
install -Dm755 dist/opencode-*/bin/opencode $out/bin/opencode
|
install -Dm755 dist/opencode-*/bin/opencode $out/bin/opencode
|
||||||
|
wrapProgram $out/bin/opencode \
|
||||||
|
--prefix PATH : ${
|
||||||
|
lib.makeBinPath (
|
||||||
|
[
|
||||||
|
ripgrep
|
||||||
|
]
|
||||||
|
++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [
|
||||||
|
sysctl
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
install -Dm644 schema.json $out/share/opencode/schema.json
|
install -Dm644 schema.json $out/share/opencode/schema.json
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
@@ -136,17 +138,8 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
|||||||
|
|
||||||
postInstall = lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) ''
|
postInstall = lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) ''
|
||||||
installShellCompletion --cmd opencode \
|
installShellCompletion --cmd opencode \
|
||||||
--bash <($out/bin/opencode completion)
|
--bash <($out/bin/opencode completion) \
|
||||||
'';
|
--zsh <(SHELL=/bin/zsh $out/bin/opencode completion)
|
||||||
|
|
||||||
postFixup = ''
|
|
||||||
wrapProgram $out/bin/opencode \
|
|
||||||
--prefix PATH : ${
|
|
||||||
lib.makeBinPath [
|
|
||||||
fzf
|
|
||||||
ripgrep
|
|
||||||
]
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeInstallCheckInputs = [
|
nativeInstallCheckInputs = [
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
From 4d0a82e8f3cf8bf011e2592677db4aa31b6b290b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Thierry Delafontaine <delafthi@pm.me>
|
|
||||||
Date: Sun, 4 Jan 2026 20:55:49 +0100
|
|
||||||
Subject: [PATCH] Remove special and windows build targets
|
|
||||||
|
|
||||||
---
|
|
||||||
packages/opencode/script/build.ts | 70 +++++++++++++++----------------
|
|
||||||
1 file changed, 35 insertions(+), 35 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/packages/opencode/script/build.ts b/packages/opencode/script/build.ts
|
|
||||||
index f51cb2924..ee3c0e863 100755
|
|
||||||
--- a/packages/opencode/script/build.ts
|
|
||||||
+++ b/packages/opencode/script/build.ts
|
|
||||||
@@ -33,27 +33,27 @@ const allTargets: {
|
|
||||||
os: "linux",
|
|
||||||
arch: "x64",
|
|
||||||
},
|
|
||||||
- {
|
|
||||||
- os: "linux",
|
|
||||||
- arch: "x64",
|
|
||||||
- avx2: false,
|
|
||||||
- },
|
|
||||||
- {
|
|
||||||
- os: "linux",
|
|
||||||
- arch: "arm64",
|
|
||||||
- abi: "musl",
|
|
||||||
- },
|
|
||||||
- {
|
|
||||||
- os: "linux",
|
|
||||||
- arch: "x64",
|
|
||||||
- abi: "musl",
|
|
||||||
- },
|
|
||||||
- {
|
|
||||||
- os: "linux",
|
|
||||||
- arch: "x64",
|
|
||||||
- abi: "musl",
|
|
||||||
- avx2: false,
|
|
||||||
- },
|
|
||||||
+ // {
|
|
||||||
+ // os: "linux",
|
|
||||||
+ // arch: "x64",
|
|
||||||
+ // avx2: false,
|
|
||||||
+ // },
|
|
||||||
+ // {
|
|
||||||
+ // os: "linux",
|
|
||||||
+ // arch: "arm64",
|
|
||||||
+ // abi: "musl",
|
|
||||||
+ // },
|
|
||||||
+ // {
|
|
||||||
+ // os: "linux",
|
|
||||||
+ // arch: "x64",
|
|
||||||
+ // abi: "musl",
|
|
||||||
+ // },
|
|
||||||
+ // {
|
|
||||||
+ // os: "linux",
|
|
||||||
+ // arch: "x64",
|
|
||||||
+ // abi: "musl",
|
|
||||||
+ // avx2: false,
|
|
||||||
+ // },
|
|
||||||
{
|
|
||||||
os: "darwin",
|
|
||||||
arch: "arm64",
|
|
||||||
@@ -62,20 +62,20 @@ const allTargets: {
|
|
||||||
os: "darwin",
|
|
||||||
arch: "x64",
|
|
||||||
},
|
|
||||||
- {
|
|
||||||
- os: "darwin",
|
|
||||||
- arch: "x64",
|
|
||||||
- avx2: false,
|
|
||||||
- },
|
|
||||||
- {
|
|
||||||
- os: "win32",
|
|
||||||
- arch: "x64",
|
|
||||||
- },
|
|
||||||
- {
|
|
||||||
- os: "win32",
|
|
||||||
- arch: "x64",
|
|
||||||
- avx2: false,
|
|
||||||
- },
|
|
||||||
+ // {
|
|
||||||
+ // os: "darwin",
|
|
||||||
+ // arch: "x64",
|
|
||||||
+ // avx2: false,
|
|
||||||
+ // },
|
|
||||||
+ // {
|
|
||||||
+ // os: "win32",
|
|
||||||
+ // arch: "x64",
|
|
||||||
+ // },
|
|
||||||
+ // {
|
|
||||||
+ // os: "win32",
|
|
||||||
+ // arch: "x64",
|
|
||||||
+ // avx2: false,
|
|
||||||
+ // },
|
|
||||||
]
|
|
||||||
|
|
||||||
const targets = singleFlag
|
|
||||||
--
|
|
||||||
2.52.0
|
|
||||||
@@ -19,8 +19,10 @@ pkgs.mkShell {
|
|||||||
name = "reichard-dev";
|
name = "reichard-dev";
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
rsync
|
|
||||||
age
|
age
|
||||||
|
git
|
||||||
|
home-manager
|
||||||
|
rsync
|
||||||
ssh-to-age
|
ssh-to-age
|
||||||
sync-repo
|
sync-repo
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user