Unverified Commit f7063307 authored by éclairevoyant's avatar éclairevoyant Committed by GitHub
Browse files

Merge pull request #308993 from eclairevoyant/webcord-update-script

webcord{,-vencord}: move to pkgs/by-name, format with nixfmt, fixes for update scripts
parents dd4070b4 22b2188e
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
{ webcord
, substituteAll
, lib
, vencord-web-extension
{
  webcord,
  substituteAll,
  lib,
  vencord-web-extension,
}:

# nixpkgs-update: no auto update
webcord.overrideAttrs (old: {
  pname = "webcord-vencord";

@@ -14,8 +16,13 @@ webcord.overrideAttrs (old: {
    })
  ];

  meta = with lib; old.meta // {
  meta = {
    inherit (old.meta) license mainProgram platforms;

    description = "Webcord with Vencord web extension";
    maintainers = with maintainers; [ FlafyDev NotAShelf ];
    maintainers = with lib.maintainers; [
      FlafyDev
      NotAShelf
    ];
  };
})
+33 −27
Original line number Diff line number Diff line
{ lib
, buildNpmPackage
, fetchFromGitHub
, copyDesktopItems
, python3
, xdg-utils
, electron_29
, makeDesktopItem
, nix-update-script
{
  lib,
  buildNpmPackage,
  fetchFromGitHub,
  copyDesktopItems,
  python3,
  xdg-utils,
  electron,
  makeDesktopItem,
}:

buildNpmPackage rec {
@@ -16,7 +16,7 @@ buildNpmPackage rec {
  src = fetchFromGitHub {
    owner = "SpacingBat3";
    repo = "WebCord";
    rev = "v${version}";
    rev = "refs/tags/v${version}";
    hash = "sha256-x9Ejb8yxgQhlEfUUfoqbgSffNNtOoFeAyb3OISR+Jz4=";
  };

@@ -53,7 +53,7 @@ buildNpmPackage rec {
      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_29}' $out/bin/webcord \
      makeWrapper '${lib.getExe electron}' $out/bin/webcord \
        --suffix PATH : "${binPath}" \
        --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
        --add-flags $out/lib/node_modules/webcord/
@@ -68,11 +68,14 @@ buildNpmPackage rec {
      icon = "webcord";
      desktopName = "WebCord";
      comment = meta.description;
      categories = [ "Network" "InstantMessaging" ];
      categories = [
        "Network"
        "InstantMessaging"
      ];
    })
  ];

  passthru.updateScript = nix-update-script { };
  passthru.updateScript = ./update.sh;

  meta = {
    description = "A Discord and SpaceBar electron-based client implemented without Discord API";
@@ -81,7 +84,10 @@ buildNpmPackage rec {
    changelog = "https://github.com/SpacingBat3/WebCord/releases/tag/v${version}";
    license = lib.licenses.mit;
    mainProgram = "webcord";
    maintainers = with lib.maintainers; [ eclairevoyant huantian ];
    maintainers = with lib.maintainers; [
      eclairevoyant
      huantian
    ];
    platforms = lib.platforms.linux;
  };
}
+15 −0
Original line number Diff line number Diff line
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq nix-update

set -ex

curl_github() {
    curl -L ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "$@"
}

latestTag=$(curl_github https://api.github.com/repos/SpacingBat3/Webcord/releases/latest | jq -r ".tag_name")
latestVersion="$(expr "$latestTag" : 'v\(.*\)')"

nix-update --version "$latestVersion" webcord
electronVersion=$(curl_github "https://raw.githubusercontent.com/SpacingBat3/WebCord/v$latestVersion/package.json" | jq -r ".devDependencies.electron" | sed -r 's|^\^([0-9]+).*|\1|')
sed -r "/webcord = / s|(electron_)[0-9]+|\1$electronVersion|" -i pkgs/top-level/all-packages.nix
+1 −3
Original line number Diff line number Diff line
@@ -35576,9 +35576,7 @@ with pkgs;
  webcamoid = libsForQt5.callPackage ../applications/video/webcamoid { };
  webcord = callPackage ../applications/networking/instant-messengers/webcord { };
  webcord-vencord = callPackage ../applications/networking/instant-messengers/webcord/webcord-vencord { };
  webcord = callPackage ../by-name/we/webcord/package.nix { electron = electron_29; };
  webex = callPackage ../applications/networking/instant-messengers/webex { };