Skip to content

Commit

Permalink
Merge pull request NixOS#204031 from huantianad/webcord
Browse files Browse the repository at this point in the history
webcord: init at 4.1.1
  • Loading branch information
Mic92 authored Jan 26, 2023
2 parents f2b744c + 1d1ed8f commit dba8d83
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33609,6 +33609,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 {};
Expand Down

0 comments on commit dba8d83

Please sign in to comment.