depot/third_party/nixpkgs/pkgs/by-name/yo/your_spotify/client.nix
Default email 5c370c0b2a Project import generated by Copybara.
GitOrigin-RevId: 33d1e753c82ffc557b4a585c77de43d4c922ebb5
2024-05-15 17:35:15 +02:00

58 lines
1.4 KiB
Nix

{
apiEndpoint ? "http://localhost:3000",
fetchYarnDeps,
your_spotify,
mkYarnPackage,
fixup-yarn-lock,
src,
version,
yarn,
}:
mkYarnPackage rec {
inherit version src;
pname = "your_spotify_client";
name = "your_spotify_client-${version}";
packageJSON = ./package.json;
offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-5SgknaRVzgO2Dzc8MhAaM8UERWMv+PrItzevoWHbWnA=";
};
configurePhase = ''
runHook preConfigure
export HOME=$(mktemp -d)
yarn config --offline set yarn-offline-mirror $offlineCache
fixup-yarn-lock yarn.lock
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
patchShebangs node_modules/
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
pushd ./apps/client/
yarn --offline run build
export API_ENDPOINT="${apiEndpoint}"
substituteInPlace scripts/run/variables.sh --replace-quiet '/app/apps/client/' "./"
chmod +x ./scripts/run/variables.sh
patchShebangs --build ./scripts/run/variables.sh
./scripts/run/variables.sh
popd
runHook postBuild
'';
nativeBuildInputs = [yarn fixup-yarn-lock];
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r ./apps/client/build/* $out
runHook postInstall
'';
doDist = false;
meta = {
inherit (your_spotify.meta) homepage changelog description license maintainers;
};
}