about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/gotify/ui.nix
blob: e22831cfbbdcadcb77bb27e4a1a79e76a52554b6 (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
{ stdenv
, yarn
, prefetch-yarn-deps
, nodejs-slim
, fetchFromGitHub
, fetchYarnDeps
, gotify-server
}:

stdenv.mkDerivation rec {
  pname = "gotify-ui";
  inherit (gotify-server) version;

  src = gotify-server.src + "/ui";

  offlineCache = fetchYarnDeps {
    yarnLock = "${src}/yarn.lock";
    hash = "sha256-ejHzo6NHCMlNiYePWvfMY9Blb58pj3UQ5PFI0V84flI=";
  };

  nativeBuildInputs = [ yarn prefetch-yarn-deps nodejs-slim ];

  postPatch = ''
    export HOME=$NIX_BUILD_TOP/fake_home
    yarn config --offline set yarn-offline-mirror $offlineCache
    fixup-yarn-lock yarn.lock
    yarn install --offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive
    patchShebangs node_modules/
  '';

  buildPhase = ''
    runHook preBuild

    export NODE_OPTIONS=--openssl-legacy-provider
    yarn --offline build

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mv build $out

    runHook postInstall
  '';
}