evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / we / webcord / package.nix
blob8c376b19fe65f14ce7e69fbe25d2ee6512f71f19
2   lib,
3   buildNpmPackage,
4   fetchFromGitHub,
5   copyDesktopItems,
6   python3,
7   xdg-utils,
8   electron,
9   makeDesktopItem,
12 buildNpmPackage rec {
13   pname = "webcord";
14   version = "4.10.2";
16   src = fetchFromGitHub {
17     owner = "SpacingBat3";
18     repo = "WebCord";
19     rev = "refs/tags/v${version}";
20     hash = "sha256-vzTT8tHpbJSt1PosgKTg3pT4a9UfPabtJppLLD9znhU=";
21   };
23   npmDepsHash = "sha256-nVQv+GSnfQa8V/RitvV2juokbiRJ/vIMLWcg9QPDbP0=";
25   nativeBuildInputs = [
26     copyDesktopItems
27     python3
28   ];
30   # npm install will error when electron tries to download its binary
31   # we don't need it anyways since we wrap the program with our nixpkgs electron
32   env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
34   # remove husky commit hooks, errors and aren't needed for packaging
35   postPatch = ''
36     rm -rf .husky
37   '';
39   # override installPhase so we can copy the only folders that matter
40   installPhase =
41     let
42       binPath = lib.makeBinPath [ xdg-utils ];
43     in
44     ''
45       runHook preInstall
47       # Remove dev deps that aren't necessary for running the app
48       npm prune --omit=dev
50       mkdir -p $out/lib/node_modules/webcord
51       cp -r app node_modules sources package.json $out/lib/node_modules/webcord/
53       install -Dm644 sources/assets/icons/app.png $out/share/icons/hicolor/256x256/apps/webcord.png
55       # Add xdg-utils to path via suffix, per PR #181171
56       makeWrapper '${lib.getExe electron}' $out/bin/webcord \
57         --suffix PATH : "${binPath}" \
58         --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime}}" \
59         --add-flags $out/lib/node_modules/webcord/
61       runHook postInstall
62     '';
64   desktopItems = [
65     (makeDesktopItem {
66       name = "webcord";
67       exec = "webcord";
68       icon = "webcord";
69       desktopName = "WebCord";
70       comment = meta.description;
71       categories = [
72         "Network"
73         "InstantMessaging"
74       ];
75     })
76   ];
78   passthru.updateScript = ./update.sh;
80   meta = {
81     description = "A Discord and SpaceBar electron-based client implemented without Discord API";
82     homepage = "https://github.com/SpacingBat3/WebCord";
83     downloadPage = "https://github.com/SpacingBat3/WebCord/releases";
84     changelog = "https://github.com/SpacingBat3/WebCord/releases/tag/v${version}";
85     license = lib.licenses.mit;
86     mainProgram = "webcord";
87     maintainers = with lib.maintainers; [
88       huantian
89     ];
90     platforms = lib.platforms.linux;
91   };