nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 pnpm,
5 fetchPnpmDeps,
6 pnpmConfigHook,
7 nodejs,
8 fetchFromGitHub,
9 nix-update-script,
10 discord,
11 discord-ptb,
12 discord-canary,
13 discord-development,
14}:
15stdenv.mkDerivation (finalAttrs: {
16 pname = "moonlight";
17 version = "1.3.39";
18
19 src = fetchFromGitHub {
20 owner = "moonlight-mod";
21 repo = "moonlight";
22 tag = "v${finalAttrs.version}";
23 hash = "sha256-85W5OrP9Ju4ZJRUEZLpBreKxgUrHgxxZEv7KzcpqNDo=";
24 };
25
26 nativeBuildInputs = [
27 nodejs
28 pnpmConfigHook
29 pnpm
30 ];
31
32 pnpmDeps = fetchPnpmDeps {
33 inherit (finalAttrs) pname version src;
34 fetcherVersion = 3;
35 hash = "sha256-+wGup5wJIqTzkr4mTo/CxofffQmUz3JD2s/s/oY0viM=";
36 };
37
38 env = {
39 NODE_ENV = "production";
40 MOONLIGHT_BRANCH = "stable";
41 MOONLIGHT_VERSION = "v${finalAttrs.version} (nixpkgs)";
42 };
43
44 patches = [
45 ./disable_updates.patch
46 ];
47
48 buildPhase = ''
49 runHook preBuild
50
51 pnpm run build
52
53 runHook postBuild
54 '';
55
56 installPhase = ''
57 runHook preInstall
58
59 cp -r dist $out
60
61 runHook postInstall
62 '';
63
64 passthru = {
65 updateScript = nix-update-script { };
66 tests = lib.genAttrs' [ discord discord-ptb discord-canary discord-development ] (
67 p: lib.nameValuePair p.pname p.tests.withMoonlight
68 );
69 };
70
71 meta = {
72 description = "Discord client modification, focused on enhancing user and developer experience";
73 longDescription = ''
74 Moonlight is a ***passion project***—yet another Discord client mod—focused on providing a decent user
75 and developer experience. Heavily inspired by hh3 (a private client mod) and the projects before it, namely EndPwn.
76 All core code is original or used with permission from their respective authors where not copyleft.
77 '';
78 homepage = "https://moonlight-mod.github.io";
79 downloadPage = "https://moonlight-mod.github.io/using/install/#nix";
80 changelog = "https://raw.githubusercontent.com/moonlight-mod/moonlight/refs/tags/v${finalAttrs.version}/CHANGELOG.md";
81
82 license = lib.licenses.lgpl3;
83 maintainers = with lib.maintainers; [
84 ilys
85 FlameFlag
86 ];
87 };
88})