From dfe63e525e7fac54547b9c9ebca9dabebe97b607 Mon Sep 17 00:00:00 2001 From: Sapphire Date: Sun, 8 Jun 2025 08:43:06 -0500 Subject: [PATCH] [bugfix] Fix mod installation on NixOS (#870) * fix(services/bs-mods-manager): inherit env on linux when starting bsipa * fix(services/linux,bs-mods-manager): use proton wine on nixos --- src/main/services/linux.service.ts | 7 +------ src/main/services/mods/bs-mods-manager.service.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/services/linux.service.ts b/src/main/services/linux.service.ts index 7f92bed4..5f12896a 100644 --- a/src/main/services/linux.service.ts +++ b/src/main/services/linux.service.ts @@ -129,12 +129,7 @@ export class LinuxService { return fs.pathExistsSync(protonPath) && fs.pathExistsSync(winePath); } - public async getWinePath(): Promise { - if (await this.isNixOS()) { - // Use system wine for nixos - return "wine"; - } - + public getWinePath(): string { if (!this.staticConfig.has("proton-folder")) { throw new Error("proton-folder variable not set"); } diff --git a/src/main/services/mods/bs-mods-manager.service.ts b/src/main/services/mods/bs-mods-manager.service.ts index 5f726093..60cc1905 100644 --- a/src/main/services/mods/bs-mods-manager.service.ts +++ b/src/main/services/mods/bs-mods-manager.service.ts @@ -162,18 +162,22 @@ export class BsModsManagerService { let winePath: string = ""; if (process.platform === "linux") { const { error: winePathError, result: winePathResult } = - await tryit(async () => this.linuxService.getWinePath()); + tryit(() => this.linuxService.getWinePath()); if (winePathError) { log.error(winePathError); return false; } - winePath = `"${winePathResult}"`; + + winePath = await this.linuxService.isNixOS() + ? `steam-run "${winePathResult}"` + : `"${winePathResult}"`; const winePrefix = this.linuxService.getWinePrefixPath(); if (!winePrefix) { throw new CustomError("Could not find BSManager WINEPREFIX path", "no-wineprefix"); } env.WINEPREFIX = winePrefix; + Object.assign(env, process.env); } return new Promise(resolve => {