about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/hydrogen-web/unwrapped.nix
blob: 7a3ad36e47b7409adad029018cabc7e603af61bd (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
59
60
61
62
63
64
65
{ lib
, stdenv
, fetchFromGitHub
, fetchYarnDeps
, yarn
, fixup-yarn-lock
, nodejs
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "hydrogen-web";
  version = "0.4.0";

  src = fetchFromGitHub {
    owner = "vector-im";
    repo = finalAttrs.pname;
    rev = "v${finalAttrs.version}";
    hash = "sha256-u8Yex3r7EZH+JztQHJbfncYeyyl6hgb1ZNFIg//wcb0=";
  };

  offlineCache = fetchYarnDeps {
    yarnLock = finalAttrs.src + "/yarn.lock";
    hash = "sha256-N9lUAhfYLlEAIaWSNS3Ecq+aBTz+f7Z22Sclwj9rp6w=";
  };

  nativeBuildInputs = [ yarn fixup-yarn-lock nodejs ];

  configurePhase = ''
    runHook preConfigure

    export HOME=$PWD/tmp
    mkdir -p $HOME

    fixup-yarn-lock yarn.lock
    yarn config --offline set yarn-offline-mirror $offlineCache
    yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
    patchShebangs node_modules

    runHook postConfigure
  '';

  buildPhase = ''
    runHook preBuild

    yarn build --offline

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    cp -R target $out

    runHook postInstall
  '';

  meta = {
    description = "Lightweight matrix client with legacy and mobile browser support";
    homepage = "https://github.com/vector-im/hydrogen-web";
    maintainers = lib.teams.matrix.members;
    license = lib.licenses.asl20;
    platforms = lib.platforms.all;
  };
})