Files
nixpkgs/pkgs/by-name/we/webcord/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

96 lines
2.5 KiB
Nix

{
lib,
buildNpmPackage,
fetchFromGitHub,
copyDesktopItems,
python3,
xdg-utils,
electron_36,
makeDesktopItem,
}:
buildNpmPackage rec {
pname = "webcord";
version = "4.11.1";
src = fetchFromGitHub {
owner = "SpacingBat3";
repo = "WebCord";
tag = "v${version}";
hash = "sha256-u2Asoc5cwVRtD6yz77iJ8hA2IfVSA4iYI8snPCLufnE=";
};
npmDepsHash = "sha256-sREnthfmE01yzVwqMN6zbhTAquulztriytMSOcj3ZCo=";
makeCacheWritable = true;
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
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
installPhase =
let
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
makeWrapper '${lib.getExe electron_36}' $out/bin/webcord \
--suffix PATH : "${binPath}" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
--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 = ./update.sh;
meta = {
description = "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}";
license = lib.licenses.mit;
mainProgram = "webcord";
maintainers = with lib.maintainers; [
huantian
NotAShelf
];
platforms = lib.platforms.linux;
};
}