nixpkgs/pkgs/applications/networking/instant-messengers/webcord/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

95 lines
2.6 KiB
Nix
Raw Normal View History

{ lib
, buildNpmPackage
, fetchFromGitHub
, copyDesktopItems
, python3
, pipewire
, libpulseaudio
, xdg-utils
2023-10-15 02:31:08 +00:00
, electron_27
, makeDesktopItem
, nix-update-script
}:
buildNpmPackage rec {
pname = "webcord";
2023-10-15 02:31:08 +00:00
version = "4.5.0";
src = fetchFromGitHub {
owner = "SpacingBat3";
repo = "WebCord";
rev = "v${version}";
2023-10-15 02:31:08 +00:00
hash = "sha256-SIGV/Hl5O+xs1DbA25TGasXJVYgCzAP/GCtsDmxKDvI=";
};
2023-10-15 02:31:08 +00:00
npmDepsHash = "sha256-ClPcLHO4+CzOswQaItbFYHVlb0W6Y5NZF140jGpoSJ8=";
nativeBuildInputs = [
copyDesktopItems
python3
];
# 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
2023-10-09 02:52:58 +00:00
env.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
2023-10-09 02:52:58 +00:00
installPhase =
let
libPath = lib.makeLibraryPath [
libpulseaudio
pipewire
];
binPath = lib.makeBinPath [ xdg-utils ];
in
''
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
# Add xdg-utils to path via suffix, per PR #181171
2023-10-15 02:31:08 +00:00
makeWrapper '${lib.getExe electron_27}' $out/bin/webcord \
--prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/webcord \
2023-10-09 02:52:58 +00:00
--suffix PATH : "${binPath}" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--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" ];
})
];
passthru.updateScript = nix-update-script { };
2023-10-09 02:52:58 +00:00
meta = {
2023-10-07 05:32:45 +00:00
description = "A Discord and SpaceBar 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}";
2023-10-09 02:52:58 +00:00
license = lib.licenses.mit;
2023-08-25 13:37:17 +00:00
mainProgram = "webcord";
2023-10-09 02:52:58 +00:00
maintainers = with lib.maintainers; [ huantian ];
platforms = lib.platforms.linux;
};
}