Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 95 lines 2.0 kB view raw
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 [ 49 pkg-config 50 go 51 stdenv.cc 52 nodejs 53 ] 54 ++ lib.optionals stdenv.hostPlatform.isLinux [ 55 gtk3 56 webkitgtk_4_0 57 ]; 58 59 ldflags = [ 60 "-s" 61 "-w" 62 ]; 63 64 # As Wails calls a compiler, certain apps and libraries need to be made available. 65 postFixup = '' 66 wrapProgram $out/bin/wails \ 67 --prefix PATH : ${ 68 lib.makeBinPath [ 69 pkg-config 70 go 71 stdenv.cc 72 nodejs 73 ] 74 } \ 75 --prefix LD_LIBRARY_PATH : "${ 76 lib.makeLibraryPath ( 77 lib.optionals stdenv.hostPlatform.isLinux [ 78 gtk3 79 webkitgtk_4_0 80 ] 81 ) 82 }" \ 83 --set PKG_CONFIG_PATH "$PKG_CONFIG_PATH" \ 84 --set CGO_LDFLAGS "-L${lib.makeLibraryPath [ zlib ]}" 85 ''; 86 87 meta = { 88 description = "Build applications using Go + HTML + CSS + JS"; 89 homepage = "https://wails.io"; 90 license = lib.licenses.mit; 91 maintainers = with lib.maintainers; [ ]; 92 mainProgram = "wails"; 93 platforms = lib.platforms.unix; 94 }; 95}