1{ lib
2, stdenv
3, buildGoModule
4, fetchFromGitHub
5, pkg-config
6, makeWrapper
7, go
8, gcc
9, gtk3
10, webkitgtk
11, nodejs
12, zlib
13}:
14
15buildGoModule rec {
16 pname = "wails";
17 version = "2.6.0";
18
19 src = fetchFromGitHub {
20 owner = "wailsapp";
21 repo = pname;
22 rev = "v${version}";
23 sha256 = "sha256-jY+2I4SOr6gr2MCLrBBE9H0T1sTB13kEb1OJ717kWqg=";
24 } + "/v2";
25
26 vendorHash = "sha256-56LZQQzfFQTa4fo5bdZtK/VzNDBPyI9hDG4RkP38gcI=";
27
28 proxyVendor = true;
29
30 subPackages = [ "cmd/wails" ];
31
32 # These packages are needed to build wails
33 # and will also need to be used when building a wails app.
34 nativeBuildInputs = [
35 pkg-config
36 makeWrapper
37 ];
38
39 # Wails apps are built with Go, so we need to be able to
40 # add it in propagatedBuildInputs.
41 allowGoReference = true;
42
43 # Following packages are required when wails used as a builder.
44 propagatedBuildInputs = [
45 pkg-config
46 go
47 gcc
48 gtk3
49 webkitgtk
50 nodejs
51 ];
52
53 ldflags = [
54 "-s"
55 "-w"
56 ];
57
58 # As Wails calls a compiler, certain apps and libraries need to be made available.
59 postFixup = ''
60 wrapProgram $out/bin/wails \
61 --prefix PATH : ${lib.makeBinPath [ pkg-config go gcc nodejs ]} \
62 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ gtk3 webkitgtk ]} \
63 --set PKG_CONFIG_PATH "$PKG_CONFIG_PATH" \
64 --set CGO_LDFLAGS "-L${lib.makeLibraryPath [ zlib ]}"
65 '';
66
67 meta = with lib; {
68 description = "Build applications using Go + HTML + CSS + JS";
69 homepage = "https://wails.io";
70 license = licenses.mit;
71 maintainers = with maintainers; [ ianmjones ];
72 platforms = platforms.linux;
73 };
74}