nix-config/pkgs/your_spotify_client.nix

57 lines
1.4 KiB
Nix
Raw Normal View History

2024-03-02 12:52:56 +01:00
{
apiEndpoint ? "http://localhost:3000",
2024-03-02 12:52:56 +01:00
fetchYarnDeps,
your_spotify,
mkYarnPackage,
prefetch-yarn-deps,
2024-04-24 01:00:57 +02:00
fixup-yarn-lock,
2024-03-04 21:10:01 +01:00
src,
2024-03-02 12:52:56 +01:00
version,
2024-03-06 13:04:44 +01:00
yarn,
2024-03-02 12:52:56 +01:00
}:
mkYarnPackage rec {
2024-03-04 21:10:01 +01:00
inherit version src;
2024-03-02 12:52:56 +01:00
pname = "your_spotify_client";
name = "your_spotify_client-${version}";
2024-03-02 12:52:56 +01:00
offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-5SgknaRVzgO2Dzc8MhAaM8UERWMv+PrItzevoWHbWnA=";
2024-03-02 12:52:56 +01:00
};
2024-03-06 13:04:44 +01:00
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
'';
2024-03-02 12:52:56 +01:00
buildPhase = ''
runHook preBuild
2024-03-06 13:04:44 +01:00
pushd ./apps/client/
2024-03-02 12:52:56 +01:00
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
2024-03-02 12:52:56 +01:00
popd
runHook postBuild
'';
2024-04-24 01:00:57 +02:00
nativeBuildInputs = [fixup-yarn-lock yarn prefetch-yarn-deps];
2024-03-06 13:04:44 +01:00
2024-03-02 12:52:56 +01:00
installPhase = ''
mkdir -p $out
2024-03-06 13:04:44 +01:00
cp -r ./apps/client/build/* $out
2024-03-02 12:52:56 +01:00
'';
doDist = false;
meta = {
inherit (your_spotify.meta) homepage changelog description license maintainers;
};
2024-03-02 12:52:56 +01:00
}