mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
bs-manager: build from source, 1.5.2 -> 1.5.3
Co-authored-by: Sapphire <imsapphire0@gmail.com>
This commit is contained in:
parent
ad50b616f8
commit
688a40ed58
4 changed files with 254 additions and 52 deletions
35
pkgs/by-name/bs/bs-manager/depotdownloader/default.nix
Normal file
35
pkgs/by-name/bs/bs-manager/depotdownloader/default.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
lib,
|
||||
buildDotnetModule,
|
||||
fetchFromGitHub,
|
||||
dotnetCorePackages,
|
||||
}:
|
||||
|
||||
buildDotnetModule {
|
||||
pname = "depotdownloader";
|
||||
version = "2.7.4-unstable-2024-12-01";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Iluhadesu";
|
||||
repo = "DepotDownloader";
|
||||
rev = "a9f58e5513b72bd00b623a83e1460b3c5db49248";
|
||||
hash = "sha256-+QfwKQJzyXqUvTn8kKP7lYHvbtRtdJ7jc/W7E87tV7w=";
|
||||
};
|
||||
|
||||
projectFile = "DepotDownloader.sln";
|
||||
nugetDeps = ./deps.json;
|
||||
dotnet-sdk = dotnetCorePackages.sdk_8_0;
|
||||
dotnet-runtime = dotnetCorePackages.runtime_8_0;
|
||||
|
||||
meta = {
|
||||
description = "Fork of DepotDownloader to be used by BSManager";
|
||||
license = lib.licenses.gpl2Only;
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
mainProgram = "DepotDownloader";
|
||||
};
|
||||
}
|
67
pkgs/by-name/bs/bs-manager/depotdownloader/deps.json
generated
Normal file
67
pkgs/by-name/bs/bs-manager/depotdownloader/deps.json
generated
Normal file
|
@ -0,0 +1,67 @@
|
|||
[
|
||||
{
|
||||
"pname": "Microsoft.NETCore.Platforms",
|
||||
"version": "5.0.0",
|
||||
"hash": "sha256-LIcg1StDcQLPOABp4JRXIs837d7z0ia6+++3SF3jl1c="
|
||||
},
|
||||
{
|
||||
"pname": "Microsoft.Win32.Registry",
|
||||
"version": "5.0.0",
|
||||
"hash": "sha256-9kylPGfKZc58yFqNKa77stomcoNnMeERXozWJzDcUIA="
|
||||
},
|
||||
{
|
||||
"pname": "Microsoft.Windows.CsWin32",
|
||||
"version": "0.3.106",
|
||||
"hash": "sha256-S1uQa684taPb6uh69784ebVpXoirMoX+pxBRA+Rrzlg="
|
||||
},
|
||||
{
|
||||
"pname": "Microsoft.Windows.SDK.Win32Docs",
|
||||
"version": "0.1.42-alpha",
|
||||
"hash": "sha256-6DvzmNzrGVfWmNJNqooj+Ya+7bAQlyeg7pmyKaUlIws="
|
||||
},
|
||||
{
|
||||
"pname": "Microsoft.Windows.SDK.Win32Metadata",
|
||||
"version": "60.0.34-preview",
|
||||
"hash": "sha256-KdRe73sXipzMvm2BLmwwBZGh+l9isZDC9l8WFyUR1zM="
|
||||
},
|
||||
{
|
||||
"pname": "Microsoft.Windows.WDK.Win32Metadata",
|
||||
"version": "0.11.4-experimental",
|
||||
"hash": "sha256-b3oKUKbr+3Udfl7RWzUY9BR/XWNsN+VmEkBxk6KiFo0="
|
||||
},
|
||||
{
|
||||
"pname": "protobuf-net",
|
||||
"version": "3.2.30",
|
||||
"hash": "sha256-keRy5OWT+/tlZt3D7x+9PEdjTvEJcZdYsf/i1ZBtciE="
|
||||
},
|
||||
{
|
||||
"pname": "protobuf-net.Core",
|
||||
"version": "3.2.30",
|
||||
"hash": "sha256-GMpJNecoBfrV2VgpYOhcZnKZaLFDObNLcX2LBTThrwY="
|
||||
},
|
||||
{
|
||||
"pname": "SteamKit2",
|
||||
"version": "3.0.0-beta.4",
|
||||
"hash": "sha256-7cXlpCuUD8ZuTMtqsT5MdklkZb+XIGBdoI28anjUXtg="
|
||||
},
|
||||
{
|
||||
"pname": "System.Collections.Immutable",
|
||||
"version": "7.0.0",
|
||||
"hash": "sha256-9an2wbxue2qrtugYES9awshQg+KfJqajhnhs45kQIdk="
|
||||
},
|
||||
{
|
||||
"pname": "System.IO.Hashing",
|
||||
"version": "8.0.0",
|
||||
"hash": "sha256-szOGt0TNBo6dEdC3gf6H+e9YW3Nw0woa6UnCGGGK5cE="
|
||||
},
|
||||
{
|
||||
"pname": "System.Security.AccessControl",
|
||||
"version": "5.0.0",
|
||||
"hash": "sha256-ueSG+Yn82evxyGBnE49N4D+ngODDXgornlBtQ3Omw54="
|
||||
},
|
||||
{
|
||||
"pname": "System.Security.Principal.Windows",
|
||||
"version": "5.0.0",
|
||||
"hash": "sha256-CBOQwl9veFkrKK2oU8JFFEiKIh/p+aJO+q9Tc2Q/89Y="
|
||||
}
|
||||
]
|
|
@ -1,87 +1,143 @@
|
|||
{
|
||||
asar,
|
||||
autoPatchelfHook,
|
||||
dpkg,
|
||||
electron,
|
||||
fetchurl,
|
||||
lib,
|
||||
makeWrapper,
|
||||
nix-update-script,
|
||||
openssl,
|
||||
stdenv,
|
||||
zlib,
|
||||
callPackage,
|
||||
nix-update-script,
|
||||
|
||||
buildNpmPackage,
|
||||
fetchNpmDeps,
|
||||
fetchFromGitHub,
|
||||
makeDesktopItem,
|
||||
|
||||
autoPatchelfHook,
|
||||
copyDesktopItems,
|
||||
makeWrapper,
|
||||
|
||||
electron,
|
||||
steam-run-free,
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
buildNpmPackage (finalAttrs: {
|
||||
pname = "bs-manager";
|
||||
version = "1.5.2";
|
||||
version = "1.5.3";
|
||||
|
||||
src =
|
||||
if stdenv.hostPlatform.system == "x86_64-linux" then
|
||||
fetchurl {
|
||||
url = "https://github.com/Zagrios/bs-manager/releases/download/v1.5.2/bs-manager_1.5.2_amd64.deb";
|
||||
hash = "sha256-rNqnEez56t4TPIKhljC0HEams2xhj6nB3CGW0CuQBKQ=";
|
||||
}
|
||||
else
|
||||
throw "BSManager is not available for your platform";
|
||||
src = fetchFromGitHub {
|
||||
owner = "Zagrios";
|
||||
repo = "bs-manager";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-thqz6sFmov5py7mUBYUC6ANBgjnNFC1hfLEsaxJVYu8=";
|
||||
};
|
||||
|
||||
# TODO: Package BSManager's fork of DepotDownloader and replace vendored binary at $out/opt/BSManager/resources/assets/scripts/DepotDownloader
|
||||
# See https://github.com/Iluhadesu/DepotDownloader
|
||||
patches = [
|
||||
# https://github.com/Zagrios/bs-manager/pull/870
|
||||
./use-steam-run-for-wine.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# don't search for resources in electron's resource directory, but our own
|
||||
substituteInPlace src/main/services/utils.service.ts \
|
||||
--replace-fail "process.resourcesPath" "'$out/share/bs-manager/resources'"
|
||||
|
||||
# replace vendored DepotDownloader with our own
|
||||
rm assets/scripts/DepotDownloader
|
||||
ln -s ${finalAttrs.passthru.depotdownloader}/bin/DepotDownloader assets/scripts/DepotDownloader
|
||||
'';
|
||||
|
||||
npmDepsHash = "sha256-VsCbz7ImDnJ0tonVhA4lOPA0w//tqF4hLhrReLUqYI8=";
|
||||
|
||||
extraNpmDeps = fetchNpmDeps {
|
||||
name = "bs-manager-${finalAttrs.version}-extra-npm-deps";
|
||||
inherit (finalAttrs) src;
|
||||
sourceRoot = "${finalAttrs.src.name}/release/app";
|
||||
hash = "sha256-JqDsv9kvYnbJdNwXN1EbppSrFVqr2cSnVhV2+8uw54g=";
|
||||
};
|
||||
|
||||
makeCacheWritable = true;
|
||||
|
||||
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
||||
|
||||
npmRebuildFlags = [ "--ignore-scripts" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
asar
|
||||
autoPatchelfHook # for vendored DepotDownloader
|
||||
dpkg
|
||||
autoPatchelfHook # for some prebuilt node deps: query-process @resvg/resvg-js
|
||||
copyDesktopItems
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
stdenv.cc.cc
|
||||
zlib
|
||||
];
|
||||
|
||||
# DepotDownloader dlopen()s libssl
|
||||
runtimeDependencies = [
|
||||
(lib.getLib openssl)
|
||||
];
|
||||
preBuild = ''
|
||||
pushd release/app
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
rm -r "$npm_config_cache"
|
||||
npmDeps="$extraNpmDeps" npmConfigHook
|
||||
npm run postinstall
|
||||
|
||||
popd
|
||||
'';
|
||||
|
||||
postBuild = ''
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w electron-dist
|
||||
|
||||
npm exec electron-builder -- \
|
||||
--dir \
|
||||
--config=electron-builder.config.js \
|
||||
-c.electronDist=electron-dist \
|
||||
-c.electronVersion=${electron.version}
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/opt/BSManager
|
||||
cp -r opt/BSManager/{locales,resources} $out/opt/BSManager
|
||||
cp -Tr usr/ $out
|
||||
for icon in build/icons/png/*.png; do
|
||||
install -Dm644 $icon $out/share/icons/hicolor/$(basename $icon .png)/apps/bs-manager.png
|
||||
done
|
||||
|
||||
# Some assets aren't included in the asar bundle. BSManager relies on
|
||||
# process.resourcesPath to load some of these assets which we have to patch later
|
||||
asar extract $out/opt/BSManager/resources/app.asar $out/opt/BSManager/resources
|
||||
rm $out/opt/BSManager/resources/app.asar
|
||||
mkdir -p $out/share/bs-manager
|
||||
cp -r release/build/*-unpacked/{locales,resources{,.pak}} $out/share/bs-manager
|
||||
|
||||
# Update desktop Exec entry
|
||||
substituteInPlace $out/share/applications/bs-manager.desktop \
|
||||
--replace-fail Exec=/opt/BSManager/bs-manager Exec=bs-manager
|
||||
|
||||
mkdir -p $out/bin
|
||||
makeWrapper ${lib.getExe electron} $out/bin/bs-manager \
|
||||
--set-default ELECTRON_FORCE_IS_PACKAGED 1 \
|
||||
--add-flags $out/opt/BSManager/resources \
|
||||
--add-flags $out/share/bs-manager/resources/app.asar \
|
||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
|
||||
--prefix PATH : ${lib.makeBinPath [ steam-run-free ]} \
|
||||
--inherit-argv0
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
substituteInPlace "$out/opt/BSManager/resources/dist/main/main.js" \
|
||||
--replace-fail "process.resourcesPath" "'$out/opt/BSManager/resources'"
|
||||
'';
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
desktopName = "BSManager";
|
||||
name = "BSManager";
|
||||
exec = "bs-manager";
|
||||
terminal = false;
|
||||
type = "Application";
|
||||
icon = "bs-manager";
|
||||
mimeTypes = [
|
||||
"x-scheme-handler/bsmanager"
|
||||
"x-scheme-handler/beatsaver"
|
||||
"x-scheme-handler/bsplaylist"
|
||||
"x-scheme-handler/modelsaber"
|
||||
"x-scheme-handler/web+bsmap"
|
||||
];
|
||||
categories = [
|
||||
"Utility"
|
||||
"Game"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
depotdownloader = callPackage ./depotdownloader { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/Zagrios/bs-manager/blob/master/CHANGELOG.md";
|
||||
changelog = "https://github.com/Zagrios/bs-manager/blob/${finalAttrs.src.rev}/CHANGELOG.md";
|
||||
description = "Your Beat Saber Assistant";
|
||||
homepage = "https://github.com/Zagrios/bs-manager";
|
||||
license = lib.licenses.gpl3Only;
|
||||
|
@ -89,8 +145,12 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
maintainers = with lib.maintainers; [
|
||||
mistyttm
|
||||
Scrumplex
|
||||
ImSapphire
|
||||
tomasajt
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
sourceProvenance = with lib.sourceTypes; [
|
||||
binaryNativeCode # prebuilt node deps
|
||||
];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||
};
|
||||
})
|
||||
|
|
40
pkgs/by-name/bs/bs-manager/use-steam-run-for-wine.patch
Normal file
40
pkgs/by-name/bs/bs-manager/use-steam-run-for-wine.patch
Normal file
|
@ -0,0 +1,40 @@
|
|||
diff --git a/src/main/services/linux.service.ts b/src/main/services/linux.service.ts
|
||||
index 7f92bed..5f12896 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<string> {
|
||||
- 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 c842fda..60cc190 100644
|
||||
--- a/src/main/services/mods/bs-mods-manager.service.ts
|
||||
+++ b/src/main/services/mods/bs-mods-manager.service.ts
|
||||
@@ -162,12 +162,15 @@ 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) {
|
Loading…
Add table
Add a link
Reference in a new issue