Nix packages for third-party projects that don't ship their own flakes
1{
2 lib,
3 buildNpmPackage,
4 fetchFromGitHub,
5}:
6
7buildNpmPackage (finalAttrs: {
8 pname = "vit";
9 version = "0.6.1";
10
11 src = fetchFromGitHub {
12 owner = "solpbc";
13 repo = "vit";
14 rev = "v${finalAttrs.version}";
15 hash = "sha256-iICVLod9SnBxm/4nQuD/cecOobP7QHRgG4LZmZEUYRg=";
16 };
17
18 # Upstream's package-lock.json (often produced via bun) is missing "resolved"
19 # URLs, which breaks nixpkgs' offline npm cache. This lockfile was regenerated
20 # with `npm install --package-lock-only` against the same version.
21 postPatch = ''
22 cp ${./package-lock.json} package-lock.json
23 '';
24
25 # Prefetched offline npm dependency cache.
26 # To update after a version bump:
27 # 1. Bump version/rev/src hash
28 # 2. Regenerate packages/vit/package-lock.json (see README)
29 # 3. Set npmDepsHash = lib.fakeHash, build once, paste the hash nix prints
30 npmDepsHash = "sha256-SNk+TDlrwgtVRLKD209iLvHba5laRQ9gmtMAsCgtZjU=";
31
32 # Pure JS CLI — no compile step. Upstream Makefile runs `bun install` (dev only).
33 dontNpmBuild = true;
34 dontBuild = true;
35
36 # Upstream postinstall copies agent skills into $HOME; skip in the build sandbox.
37 npmFlags = [ "--ignore-scripts" ];
38
39 meta = {
40 description = "Social toolkit for personalized software (AT Protocol capability CLI)";
41 homepage = "https://v-it.org";
42 changelog = "https://github.com/solpbc/vit/releases/tag/v${finalAttrs.version}";
43 license = lib.licenses.mit;
44 mainProgram = "vit";
45 platforms = lib.platforms.all;
46 };
47})