mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 11:05:31 +08:00
fix(nix): use the required Bun version for builds (#12592)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@kilocode/cli": patch
|
||||
---
|
||||
|
||||
Keep Nix builds on the Bun version required by the repository.
|
||||
@@ -21,59 +21,7 @@
|
||||
devShells = forEachSystem (pkgs: {
|
||||
default =
|
||||
let
|
||||
# Pin bun to the version declared in package.json (packageManager: "bun@1.3.14").
|
||||
# The locked nixpkgs revision ships 1.3.11, so we fetch the official release directly.
|
||||
bun =
|
||||
let
|
||||
sources = {
|
||||
"aarch64-linux" = {
|
||||
name = "bun-linux-aarch64";
|
||||
hash = "sha256-on/7Y6gxA3WDbg1vZorhf6jY0YuIw3yCHGUzGXOhmjs=";
|
||||
};
|
||||
"x86_64-linux" = {
|
||||
name = "bun-linux-x64";
|
||||
hash = "sha256-lR7iruhV8IWVruxiJSJqKY0/6oOj3NZGXAnLzN9+hI8=";
|
||||
};
|
||||
"aarch64-darwin" = {
|
||||
name = "bun-darwin-aarch64";
|
||||
hash = "sha256-2LliIYKK1vl6x6wKt+lYcjQa92MAHogD6CZ2UsJlJiA=";
|
||||
};
|
||||
"x86_64-darwin" = {
|
||||
name = "bun-darwin-x64";
|
||||
hash = "sha256-QYPfM3RiPlurMVxUfPoJdFM81FfYa3O2OfeoeXTNZjM=";
|
||||
};
|
||||
};
|
||||
source =
|
||||
sources.${pkgs.stdenv.hostPlatform.system}
|
||||
or (throw "Unsupported system for bun: ${pkgs.stdenv.hostPlatform.system}");
|
||||
in
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "bun";
|
||||
version = "1.3.14";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/oven-sh/bun/releases/download/bun-v${version}/${source.name}.zip";
|
||||
inherit (source) hash;
|
||||
};
|
||||
nativeBuildInputs = [
|
||||
pkgs.unzip
|
||||
] ++ pkgs.lib.optional pkgs.stdenv.isLinux pkgs.autoPatchelfHook;
|
||||
buildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.stdenv.cc.cc.lib ];
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 bun $out/bin/bun
|
||||
ln -s $out/bin/bun $out/bin/bunx
|
||||
runHook postInstall
|
||||
'';
|
||||
meta = {
|
||||
description = "Fast all-in-one JavaScript runtime";
|
||||
homepage = "https://bun.sh";
|
||||
license = pkgs.lib.licenses.mit;
|
||||
mainProgram = "bun";
|
||||
platforms = builtins.attrNames sources;
|
||||
};
|
||||
};
|
||||
bun = pkgs.callPackage ./nix/bun.nix { };
|
||||
|
||||
kilo-dev = pkgs.writeShellScriptBin "kilo-dev" ''
|
||||
set -euo pipefail
|
||||
@@ -279,11 +227,12 @@
|
||||
packages = forEachSystem (
|
||||
pkgs:
|
||||
let
|
||||
bun = pkgs.callPackage ./nix/bun.nix { };
|
||||
node_modules = pkgs.callPackage ./nix/node_modules.nix {
|
||||
inherit rev;
|
||||
inherit bun rev;
|
||||
};
|
||||
kilo = pkgs.callPackage ./nix/kilo.nix {
|
||||
inherit node_modules;
|
||||
inherit bun node_modules;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
unzip,
|
||||
autoPatchelfHook,
|
||||
}:
|
||||
let
|
||||
package = lib.pipe ../package.json [
|
||||
builtins.readFile
|
||||
builtins.fromJSON
|
||||
];
|
||||
version = lib.removePrefix "bun@" package.packageManager;
|
||||
sources = {
|
||||
"aarch64-linux" = {
|
||||
name = "bun-linux-aarch64";
|
||||
hash = "sha256-on/7Y6gxA3WDbg1vZorhf6jY0YuIw3yCHGUzGXOhmjs=";
|
||||
};
|
||||
"x86_64-linux" = {
|
||||
name = "bun-linux-x64";
|
||||
hash = "sha256-lR7iruhV8IWVruxiJSJqKY0/6oOj3NZGXAnLzN9+hI8=";
|
||||
};
|
||||
"aarch64-darwin" = {
|
||||
name = "bun-darwin-aarch64";
|
||||
hash = "sha256-2LliIYKK1vl6x6wKt+lYcjQa92MAHogD6CZ2UsJlJiA=";
|
||||
};
|
||||
"x86_64-darwin" = {
|
||||
name = "bun-darwin-x64";
|
||||
hash = "sha256-QYPfM3RiPlurMVxUfPoJdFM81FfYa3O2OfeoeXTNZjM=";
|
||||
};
|
||||
};
|
||||
source =
|
||||
sources.${stdenv.hostPlatform.system}
|
||||
or (throw "Unsupported system for bun: ${stdenv.hostPlatform.system}");
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "bun";
|
||||
inherit version;
|
||||
src = fetchurl {
|
||||
url = "https://github.com/oven-sh/bun/releases/download/bun-v${version}/${source.name}.zip";
|
||||
inherit (source) hash;
|
||||
};
|
||||
nativeBuildInputs = [ unzip ] ++ lib.optional stdenv.isLinux autoPatchelfHook;
|
||||
buildInputs = lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib ];
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 bun $out/bin/bun
|
||||
ln -s $out/bin/bun $out/bin/bunx
|
||||
runHook postInstall
|
||||
'';
|
||||
meta = {
|
||||
description = "Fast all-in-one JavaScript runtime";
|
||||
homepage = "https://bun.sh";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "bun";
|
||||
platforms = builtins.attrNames sources;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user