Unverified Commit 62c46964 authored by Pavol Rusnak's avatar Pavol Rusnak Committed by GitHub
Browse files

Merge pull request #215288 from mmilata/torq-web

torq: build frontend
parents 4e7bb552 7da5418f
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
{ lib
, buildGoModule
, buildNpmPackage
, fetchFromGitHub
}:

buildGoModule rec {
let
  pname = "torq";
  version = "0.17.3";

@@ -14,6 +15,27 @@ buildGoModule rec {
    hash = "sha256-fqHJZi1NQCrZqsa+N+FVYZ8s9o0D555Sqn5qNlJ1MmI=";
  };

  web = buildNpmPackage {
    pname = "${pname}-frontend";
    inherit version;
    src = "${src}/web";
    npmDepsHash = "sha256-8mUfTFzPjQlQvhC3zZf+WruDBkYnmGt3yckNi0CPWs0=";

    # 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-HETN2IMnpxnTyg6bQDpoD0saJu+gKocdEf0VzEi12Gs=";

  subPackages = [ "cmd/torq" ];
@@ -24,6 +46,10 @@ buildGoModule rec {
    "-X github.com/lncapital/torq/build.version=v${version}"
  ];

  postInstall = ''
    ln -s ${web} $out/web
  '';

  meta = with lib; {
    description = "Capital management tool for lightning network nodes";
    license = licenses.mit;