nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 buildDotnetModule,
5 dotnetCorePackages,
6 buildNpmPackage,
7 electron_39,
8 makeWrapper,
9 copyDesktopItems,
10 makeDesktopItem,
11 stdenv,
12}:
13let
14 electron = electron_39;
15 dotnet = dotnetCorePackages.dotnet_9;
16in
17buildNpmPackage (finalAttrs: {
18 pname = "vrcx";
19 version = "2026.01.04";
20
21 src = fetchFromGitHub {
22 repo = "VRCX";
23 owner = "vrcx-team";
24 tag = "v${finalAttrs.version}";
25 hash = "sha256-ibsmlNfW64mzJOhIkJydpJ9ys2PbPfyj2XBGwY5xuww=";
26 };
27
28 makeCacheWritable = true;
29 npmFlags = [ "--ignore-scripts" ];
30 npmDepsHash = "sha256-TUdzrEa2dW4rKA/9HGgF6c9JTMiBmNWvc/9R0kIKSls=";
31
32 nativeBuildInputs = [
33 makeWrapper
34 copyDesktopItems
35 ];
36
37 preBuild = ''
38 # Build fails at executing dart from sass-embedded
39 rm -r node_modules/sass-embedded*
40 '';
41
42 buildPhase = ''
43 runHook preBuild
44
45 env PLATFORM=linux npm exec vite build src
46 node ./src-electron/patch-package-version.js
47 npm exec electron-builder -- --dir \
48 -c.electronDist=${electron.dist} \
49 -c.electronVersion=${electron.version}
50 node ./src-electron/patch-node-api-dotnet.js
51
52 runHook postBuild
53 '';
54
55 installPhase = ''
56 runHook preInstall
57
58 mkdir -p "$out/share/vrcx"
59 cp -r build/*-unpacked/resources "$out/share/vrcx/"
60 mkdir -p "$out/share/vrcx/resources/app.asar.unpacked/build/Electron"
61 cp -r ${finalAttrs.passthru.backend}/build/Electron/* "$out/share/vrcx/resources/app.asar.unpacked/build/Electron/"
62
63 makeWrapper '${electron}/bin/electron' "$out/bin/vrcx" \
64 --add-flags "--ozone-platform-hint=auto --no-updater" \
65 --add-flags "$out/share/vrcx/resources/app.asar" \
66 --set NODE_ENV production \
67 --set DOTNET_ROOT ${dotnet.runtime}/share/dotnet \
68 --prefix PATH : ${lib.makeBinPath [ dotnet.runtime ]}
69
70 install -Dm644 images/VRCX.png "$out/share/icons/hicolor/256x256/apps/vrcx.png"
71
72 runHook postInstall
73 '';
74
75 desktopItems = [
76 (makeDesktopItem {
77 name = "vrcx";
78 desktopName = "VRCX";
79 comment = "Friendship management tool for VRChat";
80 icon = "vrcx";
81 exec = "vrcx";
82 terminal = false;
83 categories = [
84 "Utility"
85 "Application"
86 ];
87 mimeTypes = [ "x-scheme-handler/vrcx" ];
88 })
89 ];
90
91 passthru = {
92 backend = buildDotnetModule {
93 pname = "${finalAttrs.pname}-backend";
94 inherit (finalAttrs) version src;
95
96 dotnet-sdk = dotnet.sdk;
97 dotnet-runtime = dotnet.runtime;
98 projectFile = "Dotnet/VRCX-Electron.csproj";
99
100 nugetDeps = ./deps.json;
101
102 installPhase = ''
103 runHook preInstall
104
105 mkdir -p $out/build/Electron
106 cp -r build/Electron/* $out/build/Electron/
107
108 runHook postInstall
109 '';
110 };
111 };
112
113 meta = {
114 description = "Friendship management tool for VRChat";
115 longDescription = ''
116 VRCX is an assistant/companion application for VRChat that provides information about and helps you accomplish various things
117 related to VRChat in a more convenient fashion than relying on the plain VRChat client (desktop or VR), or website alone.
118 '';
119 license = lib.licenses.mit;
120 homepage = "https://github.com/vrcx-team/VRCX";
121 downloadPage = "https://github.com/vrcx-team/VRCX/releases";
122 maintainers = with lib.maintainers; [
123 ShyAssassin
124 ImSapphire
125 ];
126 platforms = lib.platforms.linux;
127 broken = !stdenv.hostPlatform.isx86_64;
128 };
129})