depot/nix/pkgs/lightspeed/lightspeed-react/default.nix

40 lines
1.2 KiB
Nix

{ stdenv, pkgs, fetchgit, nodejs, websocketURL ? "ws://stream.gud.software:8080/websocket" }:
let
nodePackages = import ./node-packages.nix {
inherit pkgs;
inherit (stdenv.hostPlatform) system;
};
lightspeed-react = nodePackages."lightspeed-react-git://github.com/GRVYDEV/Lightspeed-react.git";
in
stdenv.mkDerivation {
pname = "lightspeed-react";
version = "git-20210104-3d3197286672174efcae21ee3d54b13391858cf2";
# We use fetchgit here to match it with the fetch in the nodeDependencies generated code.
src = fetchgit {
url = "git://github.com/GRVYDEV/Lightspeed-react.git";
rev = "3d3197286672174efcae21ee3d54b13391858cf2";
sha256 = "c9422ddb6ec05b9fbe2b371d5c60a2d7353bc9dcbfe6c7dde7d77e770fde2238";
};
buildInputs = [ nodejs ];
patchPhase = ''
find . -name '.DS_Store' -delete
substituteInPlace src/wsUrl.js \
--replace 'ws://stream.gud.software:8080/websocket' '${websocketURL}'
'';
buildPhase = ''
ln -s ${lightspeed-react}/lib/node_modules/lightspeed-react/node_modules ./node_modules
export PATH="${lightspeed-react}/lib/node_modules/lightspeed-react/node_modules/.bin:$PATH"
react-scripts build
'';
installPhase = ''
cp -R build/ $out
'';
}