about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/rmfakecloud/webui.nix
blob: 2555bf50801cc781bbf0283d5498ba83a9e07c50 (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
{ version, src, stdenv, lib, fetchFromGitHub, fetchYarnDeps, prefetch-yarn-deps, yarn, nodejs }:

stdenv.mkDerivation rec {
  inherit version src;

  pname = "rmfakecloud-webui";

  yarnOfflineCache = fetchYarnDeps {
    yarnLock = "${src}/ui/yarn.lock";
    sha256 = "sha256-37P+acjaeG7TCyLoIHIHsB+DCUOsQOJ1H9T5SgajtLc=";
  };

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

  buildPhase = ''
    export HOME=$(mktemp -d)
    cd ui
    fixup-yarn-lock yarn.lock
    yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
    yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress
    patchShebangs node_modules
    export PATH=$PWD/node_modules/.bin:$PATH
    ./node_modules/.bin/react-scripts build
    mkdir -p $out
    cd ..
  '';

  installPhase = ''
    cp -r ui/build/* $out
  '';

  meta = with lib; {
    description = "Only the webui files for rmfakecloud";
    homepage = "https://ddvk.github.io/rmfakecloud/";
    license = licenses.agpl3Only;
  };
}