Unverified Commit de24c245 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

goofcord: 1.7.1 -> 2.2.0 (#487177)

parents 4046854c 26b6641e
Loading
Loading
Loading
Loading
+65 −0
Original line number Diff line number Diff line
# fixed output derivation for node_modules
{
  lib,
  stdenv,
  goofcord,
  bun,
  nodejs,
  writableTmpDirAsHomeHook,
}:
stdenv.mkDerivation {
  inherit (goofcord) version src;
  pname = goofcord.pname + "-modules";

  impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
    "GIT_PROXY_COMMAND"
    "SOCKS_SERVER"
  ];

  nativeBuildInputs = [
    bun
    nodejs
    writableTmpDirAsHomeHook
  ];

  dontConfigure = true;
  dontFixup = true;

  buildPhase = ''
    runHook preBuild

    export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
    export npm_config_build_from_source=true
    export ELECTRON_SKIP_BINARY_DOWNLOAD=1

    bun install \
      --frozen-lockfile \
      --linker=hoisted \
      --no-progress

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    cp -R ./node_modules $out

    runHook postInstall
  '';

  outputHash =
    {
      x86_64-linux = "sha256-EEl+hrdMR6z1PAy+uIhl2UYtajXWiUQMQxIfYpMRw6Y=";
      aarch64-linux = "sha256-ba+j8FGKNH3Mpql7xvLgHHuJxDGVlZ+TeZ3Oxsw3ot4=";
    }
    .${stdenv.hostPlatform.system} or (throw "Unsupported system ${stdenv.hostPlatform.system}");
  outputHashAlgo = "sha256";
  outputHashMode = "recursive";

  meta = {
    description = "Node modules for GoofCord";
    license = lib.licenses.osl3;
    platforms = lib.platforms.linux;
  };
}
+56 −32
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  callPackage,
  fetchFromGitHub,
  pnpm_9,
  fetchPnpmDeps,
  pnpmConfigHook,
  nodejs_22,
  nix-update-script,
  bun,
  nodejs_24,
  electron,
  pipewire,
  libpulseaudio,
  nix-update-script,
  libxkbcommon,
  libx11,
  libxcb,
  libxtst,
  makeShellWrapper,
  makeDesktopItem,
  copyDesktopItems,
}:

let
  pnpm = pnpm_9.override { nodejs = nodejs_22; };
  patchcordAddon = callPackage ./patchcord-addon.nix { };
  venbindAddon = callPackage ./venbind-addon.nix { };
in
stdenv.mkDerivation (finalAttrs: {
  pname = "goofcord";
  version = "1.7.1";
  version = "2.2.0";

  src = fetchFromGitHub {
    owner = "Milkshiift";
    repo = "GoofCord";
    rev = "v${finalAttrs.version}";
    hash = "sha256-fx/RKnUhXhaWVd/KYPVxr19/Q8o1ovm2TgMTcTYjE3Q=";
    tag = "v${finalAttrs.version}";
    hash = "sha256-BnaPw9edaI1nKAu421JBkI9dAV3Xu3Yr5VQILN0QUTM=";
  };

  nativeBuildInputs = [
    pnpmConfigHook
    pnpm
    nodejs_22
    bun
    nodejs_24
    makeShellWrapper
    copyDesktopItems
  ];

  buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
    libpulseaudio
    pipewire
    libxkbcommon
    libx11
    libxcb
    libxtst
    (lib.getLib stdenv.cc.cc)
  ];

  pnpmDeps = fetchPnpmDeps {
    inherit (finalAttrs) pname version src;
    inherit pnpm;
    fetcherVersion = 3;
    hash = "sha256-NKind57XDW7I5XNmjAu4cqkK5UVNAaKewpfOTNzF2BM=";
  };
  node-modules = callPackage ./node-modules.nix { nodejs = nodejs_24; };

  env = {
    ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
    GOOFCORD_PATCHCORD_PATH = "${patchcordAddon}/bin/patchcord";
    GOOFCORD_VENBIND_PATH = "${venbindAddon}/lib/libvenbind.so";
  };

  configurePhase = ''
    runHook preConfigure

    cp -R ${finalAttrs.node-modules} node_modules
    chmod -R u+w node_modules
    patchShebangs node_modules/.bin
    patchShebangs node_modules/@typescript/native-preview/bin

    runHook postConfigure
  '';

  preBuild = lib.optionalString stdenv.hostPlatform.isLinux ''
    cp -r ${electron.dist} electron-dist
    chmod -R u+w electron-dist
  '';

  buildPhase = ''
    runHook preBuild

    pnpm build
    bun run build -- --skipTypecheck

    npm exec electron-builder -- \
    node node_modules/electron-builder/out/cli/cli.js \
      --dir \
      -c.electronDist="${electron.dist}" \
      -c.electronVersion="${electron.version}"
      -c.electronDist="${if stdenv.hostPlatform.isLinux then "electron-dist" else electron.dist}" \
      -c.electronVersion="${electron.version}" \
      -c.npmRebuild=false

    runHook postBuild
  '';
@@ -73,13 +89,21 @@ stdenv.mkDerivation (finalAttrs: {
    mkdir -p "$out/share/lib/goofcord"
    cp -r ./dist/*-unpacked/{locales,resources{,.pak}} "$out/share/lib/goofcord"

    install -Dm644 "build/icon.png" "$out/share/icons/hicolor/256x256/apps/goofcord.png"
    install -Dm644 "assets/gf_icon.png" "$out/share/icons/hicolor/256x256/apps/goofcord.png"

    # 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/goofcord" \
      --add-flags "$out/share/lib/goofcord/resources/app.asar" \
      "''${gappsWrapperArgs[@]}" \
      --prefix LD_LIBRARY_PATH : "${
        lib.makeLibraryPath [
          libxkbcommon
          libx11
          libxcb
          libxtst
        ]
      }" \
      --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
@@ -120,11 +144,11 @@ stdenv.mkDerivation (finalAttrs: {
    homepage = "https://github.com/Milkshiift/GoofCord";
    downloadPage = "https://github.com/Milkshiift/GoofCord";
    license = lib.licenses.osl3;
    maintainers = with lib.maintainers; [ nyabinary ];
    platforms = [
      "x86_64-linux"
      "aarch64-linux"
    maintainers = with lib.maintainers; [
      nyabinary
      miniharinn
    ];
    platforms = lib.platforms.linux;
    mainProgram = "goofcord";
  };
})
+27 −0
Original line number Diff line number Diff line
{
  lib,
  rustPlatform,
  fetchFromGitHub,
}:
rustPlatform.buildRustPackage {
  pname = "patchcord";
  version = "0-unstable-2026-03-29";

  src = fetchFromGitHub {
    owner = "Milkshiift";
    repo = "patchcord";
    rev = "f2611630f143a53b46514d4916af0971d7aab2b5";
    hash = "sha256-VTHS5psVqg4RjSrAs9vPkixsVwwIYE2E4o0vXVN58tE=";
  };

  cargoHash = "sha256-/IbHvs9SEuulNcWkihwFwaFcqMM0rdFBVjCWgUu7dys=";

  doCheck = false;

  meta = {
    description = "Patcher for GoofCord";
    homepage = "https://github.com/Milkshiift/patchcord";
    license = lib.licenses.osl3;
    platforms = lib.platforms.linux;
  };
}
+56 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  rustPlatform,
  fetchFromGitHub,
  cmake,
  pkg-config,
  libx11,
  libxtst,
  libxdmcp,
  libxkbfile,
  libxkbcommon,
  libxcb,
  wayland,
  xorgproto,
}:
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "venbind";
  version = "0.1.7";

  src = fetchFromGitHub {
    owner = "tuxinal";
    repo = "venbind";
    tag = "v${finalAttrs.version}";
    hash = "sha256-6gPyQ6JjqvM2AUuIxCfO0nOLJfyQTX5bbsbKDzlNSqo=";
    fetchSubmodules = true;
  };

  cargoHash = "sha256-FZTXj8f+ezRhElovKhF3khWc5SqC+22tDHlFe9IHuwo=";

  nativeBuildInputs = [
    rustPlatform.bindgenHook
    pkg-config
    cmake
  ];

  buildInputs = [
    libx11
    libxtst
    libxdmcp
    libxkbfile
    libxkbcommon
    libxcb
    wayland
    xorgproto
  ];

  doCheck = false;

  meta = {
    description = "Native module for Vencord";
    homepage = "https://github.com/tuxinal/venbind";
    license = lib.licenses.gpl3Only;
    platforms = lib.platforms.linux;
  };
})