From 788e867a6cdf8cfc98cea068bc0c666030e5c745 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 4 Apr 2026 12:38:23 +0300 Subject: [PATCH] fix(scripts): use flake when rebuilding Electron in postinstall script --- scripts/utils.mts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/utils.mts b/scripts/utils.mts index 8490b50fd2..02883db106 100644 --- a/scripts/utils.mts +++ b/scripts/utils.mts @@ -28,7 +28,7 @@ function resetPath() { export function getElectronPath() { if (isNixOS()) { - resetPath(); + resetPath(); try { const path = execSync("which electron").toString("utf-8").trimEnd(); @@ -37,8 +37,16 @@ export function getElectronPath() { // Nothing to do, since we have a fallback below. } - console.log("Using default since no Electron is available in path."); - return execSync("nix eval --raw nixpkgs#electron_37").toString("utf-8") + "/bin/electron"; + console.log("No Electron in PATH, using 'nix develop' to get it..."); + + try { + const path = execSync("nix develop -c which electron", { stdio: ["pipe", "pipe", "pipe"] }).toString("utf-8").trimEnd(); + return path; + } catch (e) { + console.error("\nFailed to get Electron from 'nix develop'."); + console.error("Please ensure you have a valid flake.nix with electron in devShells.default."); + process.exit(1); + } } else { return "electron"; }