mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
feat(dx/desktop): support raw NixOS via LD_LIBRARY_PATH injection
This commit is contained in:
parent
7fdea613ff
commit
bd349f5abc
@ -32,6 +32,17 @@ function rebuildNativeDependencies() {
|
|||||||
buildPath: desktopProjectRoot,
|
buildPath: desktopProjectRoot,
|
||||||
electronVersion
|
electronVersion
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (isNixOS()) {
|
||||||
|
console.log("Patching ELF...");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return execSync(`nix-shell -p auto-patchelf gcc.cc.lib --run "auto-patchelf --paths node_modules/better-sqlite3/build/Release/better_sqlite3.node --libs ${libStdPath}"`, {
|
||||||
|
cwd: desktopProjectRoot,
|
||||||
|
stdio: "inherit"
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function determineElectronVersion() {
|
function determineElectronVersion() {
|
||||||
|
@ -4,11 +4,15 @@ import { join } from "path";
|
|||||||
|
|
||||||
const projectRoot = join(import.meta.dirname, "..");
|
const projectRoot = join(import.meta.dirname, "..");
|
||||||
|
|
||||||
|
let LD_LIBRARY_PATH = undefined;
|
||||||
|
let electronPath = "electron";
|
||||||
if (isNixOS()) {
|
if (isNixOS()) {
|
||||||
resetPath();
|
resetPath();
|
||||||
|
LD_LIBRARY_PATH = execSync("nix eval --raw nixpkgs#gcc.cc.lib").toString("utf-8") + "/lib";
|
||||||
|
electronPath = execSync("nix eval --raw nixpkgs#electron_37").toString("utf-8") + "/bin/electron";
|
||||||
}
|
}
|
||||||
|
|
||||||
execSync("electron ./src/main.ts", {
|
execSync(`${electronPath} ./src/main.ts`, {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
cwd: projectRoot,
|
cwd: projectRoot,
|
||||||
env: {
|
env: {
|
||||||
@ -18,6 +22,7 @@ execSync("electron ./src/main.ts", {
|
|||||||
TRILIUM_ENV: "dev",
|
TRILIUM_ENV: "dev",
|
||||||
TRILIUM_DATA_DIR: "data",
|
TRILIUM_DATA_DIR: "data",
|
||||||
TRILIUM_RESOURCE_DIR: "../server/src",
|
TRILIUM_RESOURCE_DIR: "../server/src",
|
||||||
BETTERSQLITE3_NATIVE_PATH: join(projectRoot, "node_modules/better-sqlite3/build/Release/better_sqlite3.node")
|
BETTERSQLITE3_NATIVE_PATH: join(projectRoot, "node_modules/better-sqlite3/build/Release/better_sqlite3.node"),
|
||||||
|
LD_LIBRARY_PATH
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user