forked from lugvitc/whats4linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.nix
More file actions
144 lines (121 loc) · 3.17 KB
/
package.nix
File metadata and controls
144 lines (121 loc) · 3.17 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
lib,
version ? "0.0.1",
makeWrapper,
buildGoModule,
buildNpmPackage,
pkg-config,
wails,
gtk3,
pango,
glib,
harfbuzz,
atk,
cairo,
gdk-pixbuf,
zlib,
fontconfig,
webkitgtk_4_1,
libsoup_3,
nodejs_latest,
}:
let
frontend = buildNpmPackage {
pname = "whats4linux-frontend";
inherit version;
src = ./frontend;
npmDepsHash = "sha256-IUzpbPrNFdhWGQL/e9gNRlhZmR6L8ZYJKdB8VRHCViY=";
buildPhase = ''
# runHook preBuild
# Fix shebang lines for all node executables
find node_modules/.bin -type f -exec sed -i 's|#!/usr/bin/env node|#!${nodejs_latest}/bin/node|g' {} \; || true
# Run TypeScript and Vite directly instead of npm script
${nodejs_latest}/bin/node node_modules/typescript/bin/tsc && ${nodejs_latest}/bin/node node_modules/vite/bin/vite.js build
# runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r dist $out/
runHook postInstall
'';
};
in
buildGoModule {
pname = "whats4linux";
inherit version;
src = ./.;
vendorHash = "sha256-83Ht02V6N6F2E0Sf1+Z3v3Dc4o8b8BYKTDCSYdEfzXY=";
proxyVendor = true;
subPackages = [ ]; # this defaults to "."
doBuild = false;
tags = [ "desktop,production" ];
nativeBuildInputs = [
makeWrapper
pkg-config
wails
nodejs_latest
];
buildInputs = [
gtk3.dev
pango.dev
glib.dev
harfbuzz.dev
atk.dev
cairo.dev
gdk-pixbuf.dev
zlib.dev
fontconfig.dev
webkitgtk_4_1.dev
libsoup_3.dev
];
# Build frontend first
preBuild = ''
# Copy pre-built frontend
cp -r ${frontend}/dist frontend/
# Set up a proper home directory for binding generation
export HOME=$(mktemp -d)
# Build with Wails using buildGoModule's vendoring
wails build -s -tags "webkit2_41,soup_3"
'';
buildPhase = "runHook preBuild"; # no `go build`
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/lib
[ -d build/bin ] && cp build/bin/whats4linux $out/bin/ || true
[ -d build/lib ] && cp build/lib/* $out/lib/ || true
runHook postInstall
'';
postFixup = ''
# Wrap the binary with required library paths
wrapProgram $out/bin/whats4linux \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [
gtk3
webkitgtk_4_1
libsoup_3
]}" \
--prefix PKG_CONFIG_PATH : "${lib.concatStringsSep ":" [
"${gtk3.dev}/lib/pkgconfig"
"${webkitgtk_4_1.dev}/lib/pkgconfig"
"${pango.dev}/lib/pkgconfig"
"${glib.dev}/lib/pkgconfig"
"${harfbuzz.dev}/lib/pkgconfig"
"${atk.dev}/lib/pkgconfig"
"${cairo.dev}/lib/pkgconfig"
"${gdk-pixbuf.dev}/lib/pkgconfig"
"${libsoup_3.dev}/lib/pkgconfig"
"${zlib.dev}/lib/pkgconfig"
"${fontconfig.dev}/lib/pkgconfig"
]}"
'';
meta = {
homepage = "https://github.com/lugvitc/whats4linux";
description = "An unofficial WhatsApp client for Linux";
license = lib.licenses.agpl3Plus;
maintainers = with lib.maintainers; [
zstg
];
platforms = lib.platforms.linux;
mainProgram = "whats4linux";
};
}