summaryrefslogtreecommitdiffhomepage
path: root/nix
diff options
context:
space:
mode:
authorJérôme Benoit <[email protected]>2026-01-12 19:49:06 +0100
committerGitHub <[email protected]>2026-01-12 12:49:06 -0600
commitca1b597b010bdf624fd839de479533cf5e4010df (patch)
tree84464a8c1d93a532a5d67bb986f9b1d8f2204c14 /nix
parentd527ceeb2be7c00b29f051163762e46ea6d70537 (diff)
downloadopencode-ca1b597b010bdf624fd839de479533cf5e4010df.tar.gz
opencode-ca1b597b010bdf624fd839de479533cf5e4010df.zip
fix(nix): filter optional dependencies by target platform (#8033)
Diffstat (limited to 'nix')
-rw-r--r--nix/hashes.json5
-rw-r--r--nix/node-modules.nix6
-rwxr-xr-xnix/scripts/update-hashes.sh9
3 files changed, 16 insertions, 4 deletions
diff --git a/nix/hashes.json b/nix/hashes.json
index 8de9c2319..b85e146d7 100644
--- a/nix/hashes.json
+++ b/nix/hashes.json
@@ -1,3 +1,6 @@
{
- "nodeModules": "sha256-FbV9MDkPXCSPO0TL3uYvkMmfVTDH9Lyr2r1ZolYdWW0="
+ "nodeModules": {
+ "x86_64-linux": "sha256-8nur5CuUCSV/SzD16hNXVoIlKsiPBXDzCnoITK0IhC4=",
+ "aarch64-darwin": "sha256-vD1g9dviI2nMBTTPwI87sK01hSZ+cdnmb1V72AdJYq4="
+ }
}
diff --git a/nix/node-modules.nix b/nix/node-modules.nix
index be7edd9c7..2a8f0a47c 100644
--- a/nix/node-modules.nix
+++ b/nix/node-modules.nix
@@ -5,6 +5,8 @@
bun,
cacert,
curl,
+ bunCpu,
+ bunOs,
}:
args:
stdenvNoCC.mkDerivation {
@@ -29,8 +31,8 @@ stdenvNoCC.mkDerivation {
export HOME=$(mktemp -d)
export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
bun install \
- --cpu="*" \
- --os="*" \
+ --cpu="${bunCpu}" \
+ --os="${bunOs}" \
--frozen-lockfile \
--ignore-scripts \
--no-progress \
diff --git a/nix/scripts/update-hashes.sh b/nix/scripts/update-hashes.sh
index 7bf183c5b..22c556363 100755
--- a/nix/scripts/update-hashes.sh
+++ b/nix/scripts/update-hashes.sh
@@ -33,9 +33,16 @@ trap cleanup EXIT
write_node_modules_hash() {
local value="$1"
+ local system="${2:-$SYSTEM}"
local temp
temp=$(mktemp)
- jq --arg value "$value" '.nodeModules = $value' "$HASH_FILE" >"$temp"
+
+ if jq -e '.nodeModules | type == "object"' "$HASH_FILE" >/dev/null 2>&1; then
+ jq --arg system "$system" --arg value "$value" '.nodeModules[$system] = $value' "$HASH_FILE" >"$temp"
+ else
+ jq --arg system "$system" --arg value "$value" '.nodeModules = {($system): $value}' "$HASH_FILE" >"$temp"
+ fi
+
mv "$temp" "$HASH_FILE"
}