about summary refs log tree commit diff
path: root/pkgs/by-name/yo/your_spotify/client.nix
blob: 420498821bf93acd05b378eedf542dfcfa9a6045 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
  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;
  };
}