2024-05-04 05:21:05 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildNpmPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
copyDesktopItems,
|
|
|
|
python3,
|
|
|
|
xdg-utils,
|
|
|
|
electron,
|
|
|
|
makeDesktopItem,
|
2023-07-01 20:50:25 +00:00
|
|
|
}:
|
2022-12-02 01:02:48 +00:00
|
|
|
|
|
|
|
buildNpmPackage rec {
|
2023-03-17 02:07:07 +00:00
|
|
|
pname = "webcord";
|
2024-05-19 05:45:01 +00:00
|
|
|
version = "4.9.2";
|
2022-12-02 01:02:48 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "SpacingBat3";
|
|
|
|
repo = "WebCord";
|
2024-05-04 05:20:18 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-05-19 05:45:01 +00:00
|
|
|
hash = "sha256-iuhi4ELHNPxFDz7cmiTFuUA8bf6VI2YXnHOTi69FloU=";
|
2022-12-02 01:02:48 +00:00
|
|
|
};
|
|
|
|
|
2024-05-19 05:45:01 +00:00
|
|
|
npmDepsHash = "sha256-xEXAaYW/2Wx0ar0l7jcSj0NBYKTsa7vHdykLlU0BkJE=";
|
2022-12-02 01:02:48 +00:00
|
|
|
|
|
|
|
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";
|
2022-12-02 01:02:48 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
binPath = lib.makeBinPath [ xdg-utils ];
|
|
|
|
in
|
2024-05-04 05:21:05 +00:00
|
|
|
''
|
|
|
|
runHook preInstall
|
2022-12-02 01:02:48 +00:00
|
|
|
|
2024-05-04 05:21:05 +00:00
|
|
|
# Remove dev deps that aren't necessary for running the app
|
|
|
|
npm prune --omit=dev
|
2022-12-02 01:02:48 +00:00
|
|
|
|
2024-05-04 05:21:05 +00:00
|
|
|
mkdir -p $out/lib/node_modules/webcord
|
|
|
|
cp -r app node_modules sources package.json $out/lib/node_modules/webcord/
|
2022-12-02 01:02:48 +00:00
|
|
|
|
2024-05-04 05:21:05 +00:00
|
|
|
install -Dm644 sources/assets/icons/app.png $out/share/icons/hicolor/256x256/apps/webcord.png
|
2022-12-02 01:02:48 +00:00
|
|
|
|
2024-05-04 05:21:05 +00:00
|
|
|
# Add xdg-utils to path via suffix, per PR #181171
|
|
|
|
makeWrapper '${lib.getExe electron}' $out/bin/webcord \
|
|
|
|
--suffix PATH : "${binPath}" \
|
2024-06-03 22:14:35 +00:00
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime}}" \
|
2024-05-04 05:21:05 +00:00
|
|
|
--add-flags $out/lib/node_modules/webcord/
|
2022-12-02 01:02:48 +00:00
|
|
|
|
2024-05-04 05:21:05 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2022-12-02 01:02:48 +00:00
|
|
|
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "webcord";
|
|
|
|
exec = "webcord";
|
|
|
|
icon = "webcord";
|
|
|
|
desktopName = "WebCord";
|
|
|
|
comment = meta.description;
|
2024-05-04 05:21:05 +00:00
|
|
|
categories = [
|
|
|
|
"Network"
|
|
|
|
"InstantMessaging"
|
|
|
|
];
|
2022-12-02 01:02:48 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-05-04 06:09:38 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
2023-07-01 20:50:25 +00:00
|
|
|
|
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";
|
2022-12-02 01:02:48 +00:00
|
|
|
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";
|
2024-05-04 05:21:05 +00:00
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
eclairevoyant
|
|
|
|
huantian
|
|
|
|
];
|
2023-10-09 02:52:58 +00:00
|
|
|
platforms = lib.platforms.linux;
|
2022-12-02 01:02:48 +00:00
|
|
|
};
|
|
|
|
}
|