Loading pkgs/by-name/le/legcord/package.nix +67 −24 Original line number Diff line number Diff line Loading @@ -2,48 +2,70 @@ lib, stdenv, fetchFromGitHub, pnpm_9, pnpm, nodejs, electron_34, electron, makeWrapper, copyDesktopItems, makeDesktopItem, autoPatchelfHook, pipewire, libpulseaudio, nix-update-script, }: stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: { pname = "legcord"; version = "1.1.0"; version = "1.1.1"; src = fetchFromGitHub { owner = "Legcord"; repo = "Legcord"; rev = "v${version}"; hash = "sha256-IfRjblC3L6A7HgeEDeDrRxtIMvWQB3P7mpq5bhaHWqk="; tag = "v${finalAttrs.version}"; hash = "sha256-0RbLvRCvy58HlOhHLcAoErRFgYxjWrKFQ6DPJD50c5Q="; }; nativeBuildInputs = [ pnpm_9.configHook pnpm.configHook nodejs # we use a script wrapper here for environment variable expansion at runtime # https://github.com/NixOS/nixpkgs/issues/172583 makeWrapper copyDesktopItems # legcord uses venmic, which is a shipped as a prebuilt node module # and needs to be patched autoPatchelfHook ]; pnpmDeps = pnpm_9.fetchDeps { inherit pname version src; hash = "sha256-LbHYY97HsNF9cBQzAfFw+A/tLf27y3he9Bbw9H3RKK4="; }; buildInputs = [ libpulseaudio pipewire (lib.getLib stdenv.cc.cc) ]; ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; pnpmDeps = pnpm.fetchDeps { inherit (finalAttrs) pname version src; hash = "sha256-zAf3EGIt/BWSZ9BMHWWVPWo3m+whnl/p+SahmpdLoZ4="; }; buildPhase = '' runHook preBuild pnpm build npm exec electron-builder -- \ # Replicating the build step to copy venmic from the vendored node module manually, # since the install script does not do this for whatever reason cp ./node_modules/@vencord/venmic/prebuilds/venmic-addon-linux-x64/node-napi-v7.node ./dist/venmic-x64.node cp ./node_modules/@vencord/venmic/prebuilds/venmic-addon-linux-arm64/node-napi-v7.node ./dist/venmic-arm64.node # Patch venmic before putting it into the ASAR archive autoPatchelf ./dist pnpm exec electron-builder \ --dir \ -c.electronDist="${electron_34.dist}" \ -c.electronVersion="${electron_34.version}" -c.asarUnpack="**/*.node" \ -c.electronDist="${electron.dist}" \ -c.electronVersion="${electron.version}" runHook postBuild ''; Loading @@ -56,39 +78,60 @@ stdenv.mkDerivation rec { install -Dm644 "build/icon.png" "$out/share/icons/hicolor/256x256/apps/legcord.png" makeShellWrapper "${lib.getExe electron_34}" "$out/bin/legcord" \ # use makeShellWrapper (instead of the makeBinaryWrapper provided by wrapGAppsHook3) for proper shell variable expansion # see https://github.com/NixOS/nixpkgs/issues/172583 makeShellWrapper "${lib.getExe electron}" "$out/bin/legcord" \ --add-flags "$out/share/lib/legcord/resources/app.asar" \ "''${gappsWrapperArgs[@]}" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturer --enable-wayland-ime=true}}" \ --set-default ELECTRON_IS_DEV 0 \ --inherit-argv0 runHook postInstall ''; env = { ELECTRON_SKIP_BINARY_DOWNLOAD = 1; }; desktopItems = [ (makeDesktopItem { name = "legcord"; genericName = "Internet Messenger"; desktopName = "Legcord"; exec = "legcord %U"; icon = "legcord"; comment = meta.description; categories = [ "Network" ]; comment = finalAttrs.meta.description; keywords = [ "discord" "vencord" "electron" "chat" ]; categories = [ "Network" "InstantMessaging" "Chat" ]; startupWMClass = "Legcord"; terminal = false; }) ]; passthru.updateScript = nix-update-script { }; passthru = { inherit (finalAttrs) pnpmDeps; updateScript = nix-update-script { }; }; meta = with lib; { meta = { description = "Lightweight, alternative desktop client for Discord"; homepage = "https://legcord.app"; downloadPage = "https://github.com/Legcord/Legcord"; license = licenses.osl3; maintainers = with maintainers; [ license = lib.licenses.osl3; maintainers = with lib.maintainers; [ wrmilling water-sucks nyabinary ]; platforms = [ "x86_64-linux" Loading @@ -96,4 +139,4 @@ stdenv.mkDerivation rec { ]; mainProgram = "legcord"; }; } }) Loading
pkgs/by-name/le/legcord/package.nix +67 −24 Original line number Diff line number Diff line Loading @@ -2,48 +2,70 @@ lib, stdenv, fetchFromGitHub, pnpm_9, pnpm, nodejs, electron_34, electron, makeWrapper, copyDesktopItems, makeDesktopItem, autoPatchelfHook, pipewire, libpulseaudio, nix-update-script, }: stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: { pname = "legcord"; version = "1.1.0"; version = "1.1.1"; src = fetchFromGitHub { owner = "Legcord"; repo = "Legcord"; rev = "v${version}"; hash = "sha256-IfRjblC3L6A7HgeEDeDrRxtIMvWQB3P7mpq5bhaHWqk="; tag = "v${finalAttrs.version}"; hash = "sha256-0RbLvRCvy58HlOhHLcAoErRFgYxjWrKFQ6DPJD50c5Q="; }; nativeBuildInputs = [ pnpm_9.configHook pnpm.configHook nodejs # we use a script wrapper here for environment variable expansion at runtime # https://github.com/NixOS/nixpkgs/issues/172583 makeWrapper copyDesktopItems # legcord uses venmic, which is a shipped as a prebuilt node module # and needs to be patched autoPatchelfHook ]; pnpmDeps = pnpm_9.fetchDeps { inherit pname version src; hash = "sha256-LbHYY97HsNF9cBQzAfFw+A/tLf27y3he9Bbw9H3RKK4="; }; buildInputs = [ libpulseaudio pipewire (lib.getLib stdenv.cc.cc) ]; ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; pnpmDeps = pnpm.fetchDeps { inherit (finalAttrs) pname version src; hash = "sha256-zAf3EGIt/BWSZ9BMHWWVPWo3m+whnl/p+SahmpdLoZ4="; }; buildPhase = '' runHook preBuild pnpm build npm exec electron-builder -- \ # Replicating the build step to copy venmic from the vendored node module manually, # since the install script does not do this for whatever reason cp ./node_modules/@vencord/venmic/prebuilds/venmic-addon-linux-x64/node-napi-v7.node ./dist/venmic-x64.node cp ./node_modules/@vencord/venmic/prebuilds/venmic-addon-linux-arm64/node-napi-v7.node ./dist/venmic-arm64.node # Patch venmic before putting it into the ASAR archive autoPatchelf ./dist pnpm exec electron-builder \ --dir \ -c.electronDist="${electron_34.dist}" \ -c.electronVersion="${electron_34.version}" -c.asarUnpack="**/*.node" \ -c.electronDist="${electron.dist}" \ -c.electronVersion="${electron.version}" runHook postBuild ''; Loading @@ -56,39 +78,60 @@ stdenv.mkDerivation rec { install -Dm644 "build/icon.png" "$out/share/icons/hicolor/256x256/apps/legcord.png" makeShellWrapper "${lib.getExe electron_34}" "$out/bin/legcord" \ # use makeShellWrapper (instead of the makeBinaryWrapper provided by wrapGAppsHook3) for proper shell variable expansion # see https://github.com/NixOS/nixpkgs/issues/172583 makeShellWrapper "${lib.getExe electron}" "$out/bin/legcord" \ --add-flags "$out/share/lib/legcord/resources/app.asar" \ "''${gappsWrapperArgs[@]}" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturer --enable-wayland-ime=true}}" \ --set-default ELECTRON_IS_DEV 0 \ --inherit-argv0 runHook postInstall ''; env = { ELECTRON_SKIP_BINARY_DOWNLOAD = 1; }; desktopItems = [ (makeDesktopItem { name = "legcord"; genericName = "Internet Messenger"; desktopName = "Legcord"; exec = "legcord %U"; icon = "legcord"; comment = meta.description; categories = [ "Network" ]; comment = finalAttrs.meta.description; keywords = [ "discord" "vencord" "electron" "chat" ]; categories = [ "Network" "InstantMessaging" "Chat" ]; startupWMClass = "Legcord"; terminal = false; }) ]; passthru.updateScript = nix-update-script { }; passthru = { inherit (finalAttrs) pnpmDeps; updateScript = nix-update-script { }; }; meta = with lib; { meta = { description = "Lightweight, alternative desktop client for Discord"; homepage = "https://legcord.app"; downloadPage = "https://github.com/Legcord/Legcord"; license = licenses.osl3; maintainers = with maintainers; [ license = lib.licenses.osl3; maintainers = with lib.maintainers; [ wrmilling water-sucks nyabinary ]; platforms = [ "x86_64-linux" Loading @@ -96,4 +139,4 @@ stdenv.mkDerivation rec { ]; mainProgram = "legcord"; }; } })