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