Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 fetchurl,
4 appimageTools,
5 makeWrapper,
6 writeShellApplication,
7 curl,
8 common-updater-scripts,
9}:
10let
11 pname = "beeper";
12 version = "4.1.20";
13 src = fetchurl {
14 url = "https://beeper-desktop.download.beeper.com/builds/Beeper-${version}.AppImage";
15 hash = "sha256-4sJ61j9/DdZM9mn3JqrvjlWPDb6nN4A4wzQR5lXthxU=";
16 };
17 appimageContents = appimageTools.extract {
18 inherit pname version src;
19
20 postExtract = ''
21 # disable creating a desktop file and icon in the home folder during runtime
22 linuxConfigFilename=$out/resources/app/build/main/linux-*.mjs
23 echo "export function registerLinuxConfig() {}" > $linuxConfigFilename
24
25 # disable auto update
26 sed -i 's/[^=]*\.auto_update_disabled/true/' $out/resources/app/build/main/main-entry-*.mjs
27
28 # prevent updates
29 sed -i -E 's/executeDownload\([^)]+\)\{/executeDownload(){return;/g' $out/resources/app/build/main/main-entry-*.mjs
30
31 # hide version status element on about page otherwise a error message is shown
32 sed -i '$ a\.subview-prefs-about > div:nth-child(2) {display: none;}' $out/resources/app/build/renderer/PrefsPanes-*.css
33 '';
34 };
35in
36appimageTools.wrapAppImage {
37 inherit pname version;
38
39 src = appimageContents;
40
41 extraPkgs = pkgs: [ pkgs.libsecret ];
42
43 extraInstallCommands = ''
44 install -Dm 644 ${appimageContents}/beepertexts.png $out/share/icons/hicolor/512x512/apps/beepertexts.png
45 install -Dm 644 ${appimageContents}/beepertexts.desktop -t $out/share/applications/
46 substituteInPlace $out/share/applications/beepertexts.desktop --replace-fail "AppRun" "beeper"
47
48 . ${makeWrapper}/nix-support/setup-hook
49 wrapProgram $out/bin/beeper \
50 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}} --no-update" \
51 --set APPIMAGE beeper
52 '';
53
54 passthru = {
55 updateScript = lib.getExe (writeShellApplication {
56 name = "update-beeper";
57 runtimeInputs = [
58 curl
59 common-updater-scripts
60 ];
61 text = ''
62 set -o errexit
63 latestLinux="$(curl --silent --output /dev/null --write-out "%{redirect_url}\n" https://api.beeper.com/desktop/download/linux/x64/stable/com.automattic.beeper.desktop)"
64 version="$(echo "$latestLinux" | grep --only-matching --extended-regexp '[0-9]+\.[0-9]+\.[0-9]+')"
65 update-source-version beeper "$version"
66 '';
67 });
68
69 # needed for nix-update
70 inherit src;
71 };
72
73 meta = with lib; {
74 description = "Universal chat app";
75 longDescription = ''
76 Beeper is a universal chat app. With Beeper, you can send
77 and receive messages to friends, family and colleagues on
78 many different chat networks.
79 '';
80 homepage = "https://beeper.com";
81 license = licenses.unfree;
82 maintainers = with maintainers; [
83 jshcmpbll
84 edmundmiller
85 zh4ngx
86 ];
87 platforms = [ "x86_64-linux" ];
88 };
89}