nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 buildNpmPackage,
3 copyDesktopItems,
4 electron,
5 fetchFromGitHub,
6 lib,
7 makeDesktopItem,
8 nix-update-script,
9}:
10
11buildNpmPackage rec {
12 pname = "google-chat-linux";
13 version = "5.39.24-1";
14
15 src = fetchFromGitHub {
16 owner = "squalou";
17 repo = "google-chat-linux";
18 tag = version;
19 hash = "sha256-yQBnqGyTCUr/t+PCCSTsUhKvlT5wV/F/OvCXrgeiceA=";
20 };
21
22 npmDepsHash = "sha256-8eZAn8zIDcMDKi30AiG1di4T/3xVoCewJ/e4qf7n9nY=";
23 dontNpmBuild = true;
24
25 nativeBuildInputs = [
26 copyDesktopItems
27 ];
28
29 # npm install will error when electron tries to download its binary
30 # we don't need it anyways since we wrap the program with our nixpkgs electron
31 env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
32
33 postPatch = ''
34 # https://github.com/electron/electron/issues/31121
35 substituteInPlace src/paths.js \
36 --replace-fail "process.resourcesPath" "'$out/lib/node_modules/${pname}/assets'"
37 '';
38
39 postInstall = ''
40 mkdir -p $out/share/icons
41 ln -s $out/lib/node_modules/${pname}/build/icons/icon.png $out/share/icons/${pname}.png
42 makeWrapper ${electron}/bin/electron $out/bin/${pname} \
43 --add-flags $out/lib/node_modules/${pname}/
44 '';
45
46 desktopItems = [
47 (makeDesktopItem {
48 name = "google-chat-linux";
49 exec = "google-chat-linux";
50 icon = "google-chat-linux";
51 desktopName = "Google Chat";
52 comment = meta.description;
53 categories = [
54 "Network"
55 "InstantMessaging"
56 ];
57 })
58 ];
59
60 passthru.updateScript = nix-update-script { };
61
62 meta = {
63 description = "Electron-base client for Google Hangouts Chat";
64 homepage = "https://github.com/squalou/google-chat-linux";
65 downloadPage = "https://github.com/squalou/google-chat-linux/releases";
66 changelog = "https://github.com/squalou/google-chat-linux/releases/tag/${version}";
67 license = lib.licenses.wtfpl;
68 mainProgram = "google-chat-linux";
69 maintainers = with lib.maintainers; [
70 cterence
71 ];
72 platforms = lib.platforms.linux;
73 };
74}