summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/blockchains/torq/default.nix
blob: 657e5b0e3ffabece02bdf9a0e2975f2935b761dc (plain)
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
{ lib
, buildGoModule
, buildNpmPackage
, fetchFromGitHub
}:

let
  pname = "torq";
  version = "0.18.17";

  src = fetchFromGitHub {
    owner = "lncapital";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-xiA66yGo8b1+zZ7jQ7SFOtNPmqbdna7fUCT21uibrIM=";
  };

  web = buildNpmPackage {
    pname = "${pname}-frontend";
    inherit version;
    src = "${src}/web";
    npmDepsHash = "sha256-/7x5RWYIB5BChYMnMuFVVaZd0pVkew4i4QrF7hSFnCM=";

    # copied from upstream Dockerfile
    npmInstallFlags = [ "--legacy-peer-deps" ];
    TSX_COMPILE_ON_ERROR="true";
    ESLINT_NO_DEV_ERRORS="true";

    # override npmInstallHook, we only care about the build/ directory
    installPhase = ''
      mkdir $out
      cp -r build/* $out/
    '';
  };
in
buildGoModule rec {
  inherit pname version src;

  vendorHash = "sha256-bvisI589Gq9IdyJEqI+uzs3iDPOTUkq95P3n/KoFhF0=";

  subPackages = [ "cmd/torq" ];

  ldflags = [
    "-s"
    "-w"
    "-X github.com/lncapital/torq/build.version=v${version}"
  ];

  postInstall = ''
    mkdir -p $out/web/build
    cp -r ${web}/* $out/web/build/
  '';

  meta = with lib; {
    description = "Capital management tool for lightning network nodes";
    license = licenses.mit;
    homepage = "https://github.com/lncapital/torq";
    maintainers = with maintainers; [ mmilata prusnak ];
  };
}