mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	feat(dx/desktop): improve rebuilding experience on NixOS
This commit is contained in:
		| @@ -1,3 +1,4 @@ | ||||
| import { execSync } from "child_process"; | ||||
| import { readFileSync } from "fs"; | ||||
| import { platform } from "os"; | ||||
|  | ||||
| @@ -7,7 +8,7 @@ export function isNixOS() { | ||||
|     return osReleaseFile.includes("ID=nixos"); | ||||
| } | ||||
|  | ||||
| export function resetPath() { | ||||
| function resetPath() { | ||||
|     // On Unix-like systems, PATH is usually inherited from login shell | ||||
|     // but npm prepends node_modules/.bin. Let's remove it: | ||||
|     const origPath = process.env.PATH || ""; | ||||
| @@ -18,3 +19,12 @@ export function resetPath() { | ||||
|         .filter(p => !p.includes("node_modules/.bin")) | ||||
|         .join(":"); | ||||
| } | ||||
|  | ||||
| export function getElectronPath() { | ||||
|     if (isNixOS()) { | ||||
|         resetPath();             | ||||
|         return execSync("nix eval --raw nixpkgs#electron_37").toString("utf-8") + "/bin/electron"; | ||||
|     } else { | ||||
|         return "electron"; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user