{ 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"; }; }