about summary refs log tree commit diff
path: root/pkgs/by-name/yo/your_spotify/client.nix
blob: 4453d3988621692a28bc4ac71265c4fa241e8351 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  stdenv,
  src,
  version,
  meta,
  offlineCache,
  apiEndpoint ? "http://localhost:3000",
  yarnConfigHook,
  yarnBuildHook,
  nodejs
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "your_spotify_client";
  inherit version src offlineCache;

  nativeBuildInputs = [
    yarnConfigHook
    yarnBuildHook
    nodejs
  ];

  API_ENDPOINT="${apiEndpoint}";
  preBuild = ''
    pushd ./apps/client/
  '';
  postBuild = ''
    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
  '';

  installPhase = ''
    runHook preInstall
    mkdir -p $out
    cp -r ./apps/client/build/* $out
    runHook postInstall
  '';

  inherit meta;
})