1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 pkg-config,
7 makeWrapper,
8 go,
9 nodejs,
10 zlib,
11 # Linux specific dependencies
12 gtk3,
13 webkitgtk_4_0,
14}:
15
16buildGoModule rec {
17 pname = "wails";
18 version = "2.10.1";
19
20 src =
21 fetchFromGitHub {
22 owner = "wailsapp";
23 repo = "wails";
24 tag = "v${version}";
25 hash = "sha256-PLlr2iBvYwJBvozQGvM68Xp3ts7Pt75hGhNZmMhNqbI=";
26 }
27 + "/v2";
28
29 vendorHash = "sha256-7f7QJv2PM7/CG30bWSDP4+wuhi5Aa9rXT5voHm+QivE=";
30
31 proxyVendor = true;
32
33 subPackages = [ "cmd/wails" ];
34
35 # These packages are needed to build wails
36 # and will also need to be used when building a wails app.
37 nativeBuildInputs = [
38 pkg-config
39 makeWrapper
40 ];
41
42 # Wails apps are built with Go, so we need to be able to
43 # add it in propagatedBuildInputs.
44 allowGoReference = true;
45
46 # Following packages are required when wails used as a builder.
47 propagatedBuildInputs = [
48 pkg-config
49 go
50 stdenv.cc
51 nodejs
52 ]
53 ++ lib.optionals stdenv.hostPlatform.isLinux [
54 gtk3
55 webkitgtk_4_0
56 ];
57
58 ldflags = [
59 "-s"
60 "-w"
61 ];
62
63 # As Wails calls a compiler, certain apps and libraries need to be made available.
64 postFixup = ''
65 wrapProgram $out/bin/wails \
66 --prefix PATH : ${
67 lib.makeBinPath [
68 pkg-config
69 go
70 stdenv.cc
71 nodejs
72 ]
73 } \
74 --prefix LD_LIBRARY_PATH : "${
75 lib.makeLibraryPath (
76 lib.optionals stdenv.hostPlatform.isLinux [
77 gtk3
78 webkitgtk_4_0
79 ]
80 )
81 }" \
82 --set PKG_CONFIG_PATH "$PKG_CONFIG_PATH" \
83 --set CGO_LDFLAGS "-L${lib.makeLibraryPath [ zlib ]}"
84 '';
85
86 meta = {
87 description = "Build applications using Go + HTML + CSS + JS";
88 homepage = "https://wails.io";
89 license = lib.licenses.mit;
90 maintainers = with lib.maintainers; [ ];
91 mainProgram = "wails";
92 platforms = lib.platforms.unix;
93 };
94}