Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions pkgs/by-name/go/goofcord/node-modules.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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-faR2KW27lqilZUo24cR3uJCSW4+oy5EJRDjl+0SKYzk=";
aarch64-linux = "sha256-8QTACb9YEtMNDjJWCuMINrWQcMI7DU8qppBXHjvYjww=";
}
.${stdenv.hostPlatform.system} or (throw "Unsupported system ${stdenv.hostPlatform.system}");
outputHashAlgo = "sha256";
outputHashMode = "recursive";
}
90 changes: 57 additions & 33 deletions pkgs/by-name/go/goofcord/package.nix
Original file line number Diff line number Diff line change
@@ -1,68 +1,83 @@
{
lib,
stdenv,
callPackage,
fetchFromGitHub,
pnpm_9,
fetchPnpmDeps,
pnpmConfigHook,
nodejs_22,
nix-update-script,
bun,
nodejs_24,
electron,
pipewire,
libpulseaudio,
libxkbcommon,
libx11,
libxcb,
libxtst,
makeShellWrapper,
makeDesktopItem,
copyDesktopItems,
}:

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

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

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_VENMIC_PATH = "${venmicAddon}/venmic.node";
GOOFCORD_VENBIND_PATH = "${venbindAddon}/venbind.node";
};

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
'';
Expand All @@ -73,13 +88,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
Expand Down Expand Up @@ -112,19 +135,20 @@ stdenv.mkDerivation (finalAttrs: {
];

passthru = {
updateScript = nix-update-script { };
# This will likely failed due to multiple layer of deps.
# updateScript = nix-update-script { };
};

meta = {
description = "Highly configurable and privacy-focused Discord client";
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";
};
})
65 changes: 65 additions & 0 deletions pkgs/by-name/go/goofcord/rohrkabel-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0b9d32..67b930a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,32 +82,26 @@ target_include_directories(${PROJECT_NAME} PRIVATE "include/rohrkabel")
# Setup Dependencies
# --------------------------------------------------------------------------------------------------------

-include("cmake/cpm.cmake")
+if (NOT DEFINED TL_EXPECTED_SOURCE_DIR)
+ message(FATAL_ERROR "[rohrkabel] TL_EXPECTED_SOURCE_DIR must be set to a local checkout")
+endif()

-CPMFindPackage(
- NAME tl-expected
- VERSION 1.1.0
- GIT_REPOSITORY "https://github.com/TartanLlama/expected"
- OPTIONS "EXPECTED_BUILD_TESTS OFF"
-)
+if (NOT DEFINED EREIGNIS_SOURCE_DIR)
+ message(FATAL_ERROR "[rohrkabel] EREIGNIS_SOURCE_DIR must be set to a local checkout")
+endif()

-CPMFindPackage(
- NAME ereignis
- VERSION 3.1
- GIT_REPOSITORY "https://github.com/Curve/ereignis"
-)
+if (NOT DEFINED BOOST_CALLABLE_TRAITS_SOURCE_DIR)
+ message(FATAL_ERROR "[rohrkabel] BOOST_CALLABLE_TRAITS_SOURCE_DIR must be set to a local checkout")
+endif()

-CPMFindPackage(
- NAME boost_callable_traits
- GIT_TAG boost-1.85.0
- GIT_REPOSITORY "https://github.com/boostorg/callable_traits"
-)
+if (NOT DEFINED CHANNEL_SOURCE_DIR)
+ message(FATAL_ERROR "[rohrkabel] CHANNEL_SOURCE_DIR must be set to a local checkout")
+endif()

-CPMFindPackage(
- NAME channel
- VERSION 2.3
- GIT_REPOSITORY "https://github.com/Curve/channel"
-)
+add_subdirectory("${TL_EXPECTED_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/rohrkabel-tl-expected")
+add_subdirectory("${EREIGNIS_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/rohrkabel-ereignis")
+add_subdirectory("${BOOST_CALLABLE_TRAITS_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/rohrkabel-boost-callable-traits")
+add_subdirectory("${CHANNEL_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/rohrkabel-channel")

target_link_libraries(${PROJECT_NAME} PUBLIC tl::expected cr::ereignis Boost::callable_traits cr::channel)

diff --git a/src/core.cpp b/src/core.cpp
index 77a57bd..917e491 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -9,6 +9,7 @@

#include <format>
#include <optional>
+#include <variant>

#include <pipewire/pipewire.h>

79 changes: 79 additions & 0 deletions pkgs/by-name/go/goofcord/venbind-addon.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
cmake,
pkg-config,
llvmPackages,
libx11,
libxtst,
libxdmcp,
libxkbfile,
libxkbcommon,
libxcb,
wayland,
xorgproto,
}:
let
venbindVersion = "0.1.7";
in
rustPlatform.buildRustPackage {
pname = "venbind";
version = venbindVersion;

src = fetchFromGitHub {
owner = "tuxinal";
repo = "venbind";
rev = "v${venbindVersion}";
hash = "sha256-6gPyQ6JjqvM2AUuIxCfO0nOLJfyQTX5bbsbKDzlNSqo=";
fetchSubmodules = true;
};

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

nativeBuildInputs = [
pkg-config
cmake
];

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

LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = lib.concatStringsSep " " [
"-I${stdenv.cc.libc.dev}/include"
"-I${xorgproto}/include"
"-I${libx11.dev}/include"
"-I${libxdmcp.dev}/include"
"-I${libxcb.dev}/include"
"-I${libxkbcommon.dev}/include"
"-I${libxkbfile.dev}/include"
];

doCheck = false;

installPhase = ''
runHook preInstall

addon=$(find target -path "*/release/*" \( -name "*.node" -o -name "libvenbind.so" \) | head -n1)
if [ -z "$addon" ]; then
echo "venbind: native output not found" >&2
exit 1
fi

mkdir -p $out
cp "$addon" $out/venbind.node

runHook postInstall
'';
}
Loading
Loading