nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildNpmPackage,
4 fetchFromGitHub,
5
6 pnpm_10,
7 pnpm ? pnpm_10,
8 fetchPnpmDeps,
9 pnpmConfigHook,
10 makeBinaryWrapper,
11 nix-update-script,
12
13 nodejs,
14}:
15
16buildNpmPackage (finalAttrs: {
17 pname = "sub-store";
18 version = "2.21.15";
19
20 src = fetchFromGitHub {
21 owner = "sub-store-org";
22 repo = "Sub-Store";
23 tag = finalAttrs.version;
24 hash = "sha256-QCmjK/shsys8rYdWhG4XE7FIeqdPcethOLuAd/69yrw=";
25 };
26
27 sourceRoot = "${finalAttrs.src.name}/backend";
28
29 nativeBuildInputs = [
30 makeBinaryWrapper
31 pnpm
32 ];
33
34 npmDeps = null;
35 pnpmDeps = fetchPnpmDeps {
36 inherit (finalAttrs)
37 pname
38 version
39 src
40 sourceRoot
41 ;
42 inherit pnpm;
43 fetcherVersion = 3;
44 hash = "sha256-VsK6qvBeOF2smXRFmMk4gWxQgAD1GG/ExvZdIERdz9g=";
45 };
46
47 npmConfigHook = pnpmConfigHook;
48 npmBuildScript = "bundle:esbuild";
49
50 installPhase = ''
51 runHook preInstall
52
53 mkdir -p $out/share
54 cp -r dist $out/share/sub-store
55 makeWrapper ${lib.getExe nodejs} $out/bin/sub-store \
56 --add-flags "$out/share/sub-store/sub-store.bundle.js"
57
58 runHook postInstall
59 '';
60
61 passthru.updateScript = nix-update-script { };
62
63 meta = {
64 description = "Advanced Subscription Manager for QX, Loon, Surge, Stash, Egern and Shadowrocket";
65 homepage = "https://github.com/sub-store-org/Sub-Store";
66 changelog = "https://github.com/sub-store-org/Sub-Store/releases/tag/${finalAttrs.version}";
67 license = lib.licenses.agpl3Only;
68 maintainers = with lib.maintainers; [ moraxyc ];
69 mainProgram = "sub-store";
70 platforms = nodejs.meta.platforms;
71 };
72})