Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix bun gen-api on nixos (#1223)

Sean Aye2f854fa7b405
diff --git a/js/app/scripts/generate-api-schema.ts b/js/app/scripts/generate-api-schema.ts
index d9d2094fe6..6c260ab449 100644
--- a/js/app/scripts/generate-api-schema.ts
+++ b/js/app/scripts/generate-api-schema.ts
@@ -174,7 +174,15 @@ async function main() {
});
process.exit(1);
}
- await $`bunx biome check --write --unsafe packages/service-clients/`;
+ // On NixOS, the npm-installed biome binary doesn't work due to dynamic linking issues.
+ // We detect NixOS and use the system biome instead.
+ const isNixOS = process.env.NIX_PATH !== undefined || (await Bun.file("/etc/os-release").exists() && (await Bun.file("/etc/os-release").text()).includes("NixOS"));
+ if (isNixOS) {
+ const systemBiomePath = await $`bash -c 'PATH=$(echo "$PATH" | tr ":" "\n" | grep -v node_modules | tr "\n" ":") which biome'`.text();
+ await $`${systemBiomePath.trim()} check --write --unsafe packages/service-clients/`;
+ } else {
+ await $`biome check --write --unsafe packages/service-clients/`;
+ }
// In check mode, verify no uncommitted changes
if (checkMode) {
diff --git a/js/app/scripts/generate-dcs-tools.ts b/js/app/scripts/generate-dcs-tools.ts
index 9b5e69ad7c..9628be5328 100644
--- a/js/app/scripts/generate-dcs-tools.ts
+++ b/js/app/scripts/generate-dcs-tools.ts
@@ -421,7 +421,15 @@ tools.sort((a, b) => a.name.localeCompare(b.name));
await generateSchemasFile(tools);
await generateToolsFile(tools);
await generateToolTypesFile(tools);
-await $`bunx biome format --write --no-errors-on-unmatched ${toolFile} ${schemasFile} ${typesFile}`;
+// On NixOS, the npm-installed biome binary doesn't work due to dynamic linking issues.
+// We detect NixOS and use the system biome instead.
+const isNixOS = process.env.NIX_PATH !== undefined || (await Bun.file("/etc/os-release").exists() && (await Bun.file("/etc/os-release").text()).includes("NixOS"));
+if (isNixOS) {
+ const systemBiomePath = await $`bash -c 'PATH=$(echo "$PATH" | tr ":" "\n" | grep -v node_modules | tr "\n" ":") which biome'`.text();
+ await $`${systemBiomePath.trim()} format --write --no-errors-on-unmatched ${toolFile} ${schemasFile} ${typesFile}`;
+} else {
+ await $`biome format --write --no-errors-on-unmatched ${toolFile} ${schemasFile} ${typesFile}`;
+}
console.log(
`Generated AI tools types at: ${serviceDir}/generated/tools/tools.ts`,