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
{ lib, fetchFromGitHub, buildGo123Module, buildNpmPackage, stdenv, olm, withGoolm ? true, ... }:
let
cppStdLib = if stdenv.hostPlatform.isDarwin then "-lc++" else "-lstdc++";
in buildGo123Module rec {
pname = "gomuks-web";
version = "0.4.0-${builtins.substring 0 6 rev}";
rev = "fac444acd101762df62550fc298c2be1f92fbb54";
sha256 = "sha256-pqMRJBcxiBkGelgPJd04OfWRqI9tLE4+ab083S73/cA=";
src = fetchFromGitHub {
owner = "tulir";
repo = "gomuks";
inherit rev sha256;
};
frontend = buildNpmPackage{
name = "${pname}_${version}-frontend";
src = "${src}/web";
inherit version;
npmBuildScript = "build";
npmDepsHash = "sha256-Mt2gJ1lLT3oQ3RKr3XTVFXkS/Xmjy0gahbdaxxrO+6g=";
installPhase = ''
cp -r dist $out
'';
};
vendorHash = "sha256-qeSxxd9ml2ENAYSPkdd1OWqy2DULnwLUVkKje47uT/I=";
buildInputs = (lib.optional (!withGoolm) olm) ++ (lib.optional withGoolm stdenv.cc.cc.lib);
CGO_LDFLAGS = lib.optional withGoolm [ cppStdLib ];
tags = lib.optional withGoolm "goolm";
subPackages = [ "cmd/gomuks" ];
preBuild = ''
cp -r ${frontend} ./web/dist;
'';
installPhase = ''
mkdir -p $out/bin;
cp $GOPATH/bin/gomuks $out/bin/gomuks-web;
'';
doCheck = false;
meta = {
description = "A Matrix client written in Go";
homepage = "https://github.com/tulir/gomuks";
mainProgram = "gomuks-web";
};
}