diff --git a/pkgs/applications/networking/instant-messengers/webcord/default.nix b/pkgs/applications/networking/instant-messengers/webcord/default.nix new file mode 100644 index 000000000000..d03205720312 --- /dev/null +++ b/pkgs/applications/networking/instant-messengers/webcord/default.nix @@ -0,0 +1,81 @@ +{ lib, stdenv, buildNpmPackage, fetchFromGitHub, copyDesktopItems +, python3, pipewire, libpulseaudio, xdg-utils, electron_22, makeDesktopItem }: + +buildNpmPackage rec { + name = "webcord"; + version = "4.1.1"; + + src = fetchFromGitHub { + owner = "SpacingBat3"; + repo = "WebCord"; + rev = "v${version}"; + sha256 = "sha256-Buu7eKmI0UGV/9Kfj+urmDcjBtR9HSwW+mlHaYhfUa4="; + }; + + npmDepsHash = "sha256-PeoOoEljbkHynjZwocCWCTyYvIvSE1gQiABUzIiXEdM="; + + nativeBuildInputs = [ + copyDesktopItems + python3 + ]; + + libPath = lib.makeLibraryPath [ + pipewire + libpulseaudio + ]; + + binPath = lib.makeBinPath [ + xdg-utils + ]; + + # npm install will error when electron tries to download its binary + # we don't need it anyways since we wrap the program with our nixpkgs electron + ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + + # remove husky commit hooks, errors and aren't needed for packaging + postPatch = '' + rm -rf .husky + ''; + + # override installPhase so we can copy the only folders that matter + installPhase = '' + runHook preInstall + + # Remove dev deps that aren't necessary for running the app + npm prune --omit=dev + + mkdir -p $out/lib/node_modules/webcord + cp -r app node_modules sources package.json $out/lib/node_modules/webcord/ + + install -Dm644 sources/assets/icons/app.png $out/share/icons/hicolor/256x256/apps/webcord.png + + makeWrapper '${electron_22}/bin/electron' $out/bin/webcord \ + --prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/webcord \ + --prefix PATH : "${binPath}" \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland}}" \ + --add-flags $out/lib/node_modules/webcord/ + + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + name = "webcord"; + exec = "webcord"; + icon = "webcord"; + desktopName = "WebCord"; + comment = meta.description; + categories = [ "Network" "InstantMessaging" ]; + }) + ]; + + meta = with lib; { + description = "A Discord and Fosscord electron-based client implemented without Discord API"; + homepage = "https://github.com/SpacingBat3/WebCord"; + downloadPage = "https://github.com/SpacingBat3/WebCord/releases"; + changelog = "https://github.com/SpacingBat3/WebCord/releases/tag/v${version}"; + license = licenses.mit; + maintainers = with maintainers; [ huantian ]; + platforms = electron_22.meta.platforms; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c6c6afb60b06..149bd2aeef5f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33006,6 +33006,8 @@ with pkgs; webcamoid = libsForQt5.callPackage ../applications/video/webcamoid { }; + webcord = callPackage ../applications/networking/instant-messengers/webcord {}; + webex = callPackage ../applications/networking/instant-messengers/webex {}; webmacs = libsForQt5.callPackage ../applications/networking/browsers/webmacs {};