Hello, I’ve been trying to package slippi for nix.
It’s an electron app that uses yarn as its package manager; so naturally I used mkYarnPackage
, but I think I messed up somewhere.
I’m stuck with the following issues:
- There are a lot of warnings, which I am not sure is normal
- It simply doesn’t build because
ts-node
is not found, it is however inpackage.json
, so should it not be installed already ?
Here is my derivation, any help is appreciated !
{
electron,
fetchFromGitHub,
lib,
makeDesktopItem,
makeWrapper,
mkYarnPackage,
slippi-netplay,
replaceVars,
}:
let
pname = "slippi-launcher";
version = "2.11.10";
src = fetchFromGitHub {
owner = "project-slippi";
repo = "slippi-launcher";
tag = "v${version}";
hash = "sha256-JrM2nm5iEAoyrGeqF1iP+kKjdiC/3mfCihzawg3Xv9s=";
};
in
mkYarnPackage {
inherit pname version src;
packageJSON = "${src}/package.json";
yarnLock = "${src}/yarn.lock";
nativeBuildInputs = [
makeWrapper
];
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
patches = [
(replaceVars ./0001-replace-findDolphinExecutable-by-NIX_DOLPHIN_PATH-va.patch {
NIX_DOLPHIN_PATH = "${lib.getExe slippi-netplay}";
})
];
postBuild = ''
yarn --offline run package
--dir \
-c.electronDist=${electron}/lib/electron \
-c.electronVersion=${electron.version}
'';
installPhase = ''
runHook preInstall
makeWrapper "${lib.getExe electron}" "$out/bin/${pname}" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--inherit-argv0
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = pname;
desktopName = "Slippi Launcher";
exec = "slippi-launcher %U";
icon = "slippi-launcher";
keywords = [
"melee"
"netplay"
"rollback"
"smash"
];
categories = [
"Emulator"
"Game"
"Network"
];
terminal = false;
})
];
meta = {
homepage = "https://slippi.gg";
description = "The way to play Slippi Online and watch replays";
platforms = lib.platforms.linux;
license = lib.licenses.gpl3Only;
};
}
Here are the logs
$ nix build .#slippi-launcher-source -L -v
this derivation will be built:
/nix/store/hhzhqvm87f0kis4wj0gc5wc0b9n5h4mv-slippi-launcher-2.11.10.drv
building '/nix/store/hhzhqvm87f0kis4wj0gc5wc0b9n5h4mv-slippi-launcher-2.11.10.drv'...
slippi-launcher> Running phase: unpackPhase
slippi-launcher> unpacking source archive /nix/store/k7j1fp1dgmb261hsh59pcr71908q9bsg-source
slippi-launcher> source root is source
slippi-launcher> Running phase: patchPhase
slippi-launcher> applying patch /nix/store/cqz54i7pzhqlf83pmzndgyk8crmyxv9p-0001-replace-findDolphinExecutable-by-NIX_DOLPHIN_PATH-va.patch
slippi-launcher> patching file src/dolphin/install/ishiiruka_installation.ts
slippi-launcher> patching file src/dolphin/install/mainline_installation.ts
slippi-launcher> patching file src/dolphin/util.ts
slippi-launcher> Running phase: updateAutotoolsGnuConfigScriptsPhase
slippi-launcher> Running phase: configurePhase
slippi-launcher> Running phase: buildPhase
slippi-launcher> no Makefile or custom buildPhase, doing nothing
slippi-launcher> yarn run v1.22.22
slippi-launcher> warning Skipping preferred cache folder "/homeless-shelter/.cache/yarn" because it is not writable.
slippi-launcher> warning Selected the next writable cache folder in the list, will be "/build/.yarn-cache-1000".
slippi-launcher> $ yarn run clean && yarn run build && electron-builder build --publish never
slippi-launcher> warning Cannot find a suitable global folder. Tried these: "/usr/local, /homeless-shelter/.yarn"
slippi-launcher> warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries.
slippi-launcher> warning Skipping preferred cache folder "/homeless-shelter/.cache/yarn" because it is not writable.
slippi-launcher> warning Selected the next writable cache folder in the list, will be "/build/.yarn-cache-1000".
slippi-launcher> $ ts-node ./.erb/scripts/clean.js dist
slippi-launcher> warning Cannot find a suitable global folder. Tried these: "/usr/local, /homeless-shelter/.yarn"
slippi-launcher> /bin/sh: ts-node: not found
slippi-launcher> error Command failed with exit code 127.
slippi-launcher> info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
slippi-launcher> error Command failed with exit code 127.
slippi-launcher> info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error: builder for '/nix/store/hhzhqvm87f0kis4wj0gc5wc0b9n5h4mv-slippi-launcher-2.11.10.drv' failed with exit code 127;
last 25 log lines:
> source root is source
> Running phase: patchPhase
> applying patch /nix/store/cqz54i7pzhqlf83pmzndgyk8crmyxv9p-0001-replace-findDolphinExecutable-by-NIX_DOLPHIN_PATH-va.patch
> patching file src/dolphin/install/ishiiruka_installation.ts
> patching file src/dolphin/install/mainline_installation.ts
> patching file src/dolphin/util.ts
> Running phase: updateAutotoolsGnuConfigScriptsPhase
> Running phase: configurePhase
> Running phase: buildPhase
> no Makefile or custom buildPhase, doing nothing
> yarn run v1.22.22
> warning Skipping preferred cache folder "/homeless-shelter/.cache/yarn" because it is not writable.
> warning Selected the next writable cache folder in the list, will be "/build/.yarn-cache-1000".
> $ yarn run clean && yarn run build && electron-builder build --publish never
> warning Cannot find a suitable global folder. Tried these: "/usr/local, /homeless-shelter/.yarn"
> warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries.
> warning Skipping preferred cache folder "/homeless-shelter/.cache/yarn" because it is not writable.
> warning Selected the next writable cache folder in the list, will be "/build/.yarn-cache-1000".
> $ ts-node ./.erb/scripts/clean.js dist
> warning Cannot find a suitable global folder. Tried these: "/usr/local, /homeless-shelter/.yarn"
> /bin/sh: ts-node: not found
> error Command failed with exit code 127.
> info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
> error Command failed with exit code 127.
> info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
For full logs, run:
nix log /nix/store/hhzhqvm87f0kis4wj0gc5wc0b9n5h4mv-slippi-launcher-2.11.10.drv