Skip to content

Build your personal knowledge base with Trilium Notes

fix(scripts): electron rebuild failing in flake

Elian Doran70ce86cd53e2
diff --git a/scripts/electron-rebuild.mts b/scripts/electron-rebuild.mts
index 0421bdba5e..9bea7ac8cd 100644
--- a/scripts/electron-rebuild.mts
+++ b/scripts/electron-rebuild.mts
@@ -6,8 +6,9 @@ import { isNixOS } from "./utils.mjs";
const workspaceRoot = join(import.meta.dirname, "..");
-// On NixOS, re-execute this script inside `nix develop` to get access to Python and other build tools
-if (isNixOS() && !process.env.IN_NIX_SHELL) {
+// On NixOS, re-execute this script inside `nix develop` to get access to Python and other build tools.
+// Skip this if we're already inside a nix shell or a nix build (NIX_BUILD_TOP is set during `nix build`).
+if (isNixOS() && !process.env.IN_NIX_SHELL && !process.env.NIX_BUILD_TOP) {
console.log("Detected NixOS, re-running electron-rebuild inside 'nix develop'...");
try {
execSync("nix develop -c pnpm exec tsx scripts/electron-rebuild.mts", {