11{
22 lib ,
33 stdenv ,
4+ callPackage ,
45 fetchFromGitHub ,
5- pnpm_9 ,
6- fetchPnpmDeps ,
7- pnpmConfigHook ,
8- nodejs_22 ,
9- nix-update-script ,
6+ bun ,
7+ nodejs_24 ,
108 electron ,
11- pipewire ,
12- libpulseaudio ,
9+ nix-update-script ,
10+ libxkbcommon ,
11+ libx11 ,
12+ libxcb ,
13+ libxtst ,
1314 makeShellWrapper ,
1415 makeDesktopItem ,
1516 copyDesktopItems ,
1617} :
17-
1818let
19- pnpm = pnpm_9 . override { nodejs = nodejs_22 ; } ;
19+ patchcordAddon = callPackage ./patchcord-addon.nix { } ;
20+ venbindAddon = callPackage ./venbind-addon.nix { } ;
2021in
2122stdenv . mkDerivation ( finalAttrs : {
2223 pname = "goofcord" ;
23- version = "1.7.1 " ;
24+ version = "2.2.0 " ;
2425
2526 src = fetchFromGitHub {
2627 owner = "Milkshiift" ;
2728 repo = "GoofCord" ;
28- rev = "v${ finalAttrs . version } " ;
29- hash = "sha256-fx/RKnUhXhaWVd/KYPVxr19/Q8o1ovm2TgMTcTYjE3Q =" ;
29+ tag = "v${ finalAttrs . version } " ;
30+ hash = "sha256-BnaPw9edaI1nKAu421JBkI9dAV3Xu3Yr5VQILN0QUTM =" ;
3031 } ;
3132
3233 nativeBuildInputs = [
33- pnpmConfigHook
34- pnpm
35- nodejs_22
34+ bun
35+ nodejs_24
3636 makeShellWrapper
3737 copyDesktopItems
3838 ] ;
3939
4040 buildInputs = lib . optionals stdenv . hostPlatform . isLinux [
41- libpulseaudio
42- pipewire
41+ libxkbcommon
42+ libx11
43+ libxcb
44+ libxtst
4345 ( lib . getLib stdenv . cc . cc )
4446 ] ;
4547
46- pnpmDeps = fetchPnpmDeps {
47- inherit ( finalAttrs ) pname version src ;
48- inherit pnpm ;
49- fetcherVersion = 3 ;
50- hash = "sha256-NKind57XDW7I5XNmjAu4cqkK5UVNAaKewpfOTNzF2BM=" ;
51- } ;
48+ node-modules = callPackage ./node-modules.nix { nodejs = nodejs_24 ; } ;
5249
5350 env = {
5451 ELECTRON_SKIP_BINARY_DOWNLOAD = 1 ;
52+ GOOFCORD_PATCHCORD_PATH = "${ patchcordAddon } /bin/patchcord" ;
53+ GOOFCORD_VENBIND_PATH = "${ venbindAddon } /lib/libvenbind.so" ;
5554 } ;
5655
56+ configurePhase = ''
57+ runHook preConfigure
58+
59+ cp -R ${ finalAttrs . node-modules } node_modules
60+ chmod -R u+w node_modules
61+ patchShebangs node_modules/.bin
62+ patchShebangs node_modules/@typescript/native-preview/bin
63+
64+ runHook postConfigure
65+ '' ;
66+
67+ preBuild = lib . optionalString stdenv . hostPlatform . isLinux ''
68+ cp -r ${ electron . dist } electron-dist
69+ chmod -R u+w electron-dist
70+ '' ;
71+
5772 buildPhase = ''
5873 runHook preBuild
5974
60- pnpm build
75+ bun run build -- --skipTypecheck
6176
62- npm exec electron-builder -- \
77+ node node_modules/ electron-builder/out/cli/cli.js \
6378 --dir \
64- -c.electronDist="${ electron . dist } " \
65- -c.electronVersion="${ electron . version } "
79+ -c.electronDist="${ if stdenv . hostPlatform . isLinux then "electron-dist" else electron . dist } " \
80+ -c.electronVersion="${ electron . version } " \
81+ -c.npmRebuild=false
6682
6783 runHook postBuild
6884 '' ;
@@ -73,13 +89,21 @@ stdenv.mkDerivation (finalAttrs: {
7389 mkdir -p "$out/share/lib/goofcord"
7490 cp -r ./dist/*-unpacked/{locales,resources{,.pak}} "$out/share/lib/goofcord"
7591
76- install -Dm644 "build/icon .png" "$out/share/icons/hicolor/256x256/apps/goofcord.png"
92+ install -Dm644 "assets/gf_icon .png" "$out/share/icons/hicolor/256x256/apps/goofcord.png"
7793
7894 # use makeShellWrapper (instead of the makeBinaryWrapper provided by wrapGAppsHook3) for proper shell variable expansion
7995 # see https://github.com/NixOS/nixpkgs/issues/172583
8096 makeShellWrapper "${ lib . getExe electron } " "$out/bin/goofcord" \
8197 --add-flags "$out/share/lib/goofcord/resources/app.asar" \
8298 "'' ${gappsWrapperArgs[@]}" \
99+ --prefix LD_LIBRARY_PATH : "${
100+ lib . makeLibraryPath [
101+ libxkbcommon
102+ libx11
103+ libxcb
104+ libxtst
105+ ]
106+ } " \
83107 --add-flags "\'' ${NIXOS_OZONE_WL:+\'' ${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturer --enable-wayland-ime=true}}" \
84108 --set-default ELECTRON_IS_DEV 0 \
85109 --inherit-argv0
@@ -120,11 +144,11 @@ stdenv.mkDerivation (finalAttrs: {
120144 homepage = "https://github.com/Milkshiift/GoofCord" ;
121145 downloadPage = "https://github.com/Milkshiift/GoofCord" ;
122146 license = lib . licenses . osl3 ;
123- maintainers = with lib . maintainers ; [ nyabinary ] ;
124- platforms = [
125- "x86_64-linux"
126- "aarch64-linux"
147+ maintainers = with lib . maintainers ; [
148+ nyabinary
149+ miniharinn
127150 ] ;
151+ platforms = lib . platforms . linux ;
128152 mainProgram = "goofcord" ;
129153 } ;
130154} )
0 commit comments