4 files changed,
+158,
-0
+4,
-0
1@@ -33,5 +33,9 @@ devenv.local.yaml
2 # direnv
3 .direnv
4
5+# nix build output
6+/result
7+/result-*
8+
9 # pre-commit
10 .pre-commit-config.yaml
+30,
-0
1@@ -27,6 +27,36 @@ npm install -g local-code-review
2
3 Requires Node.js 18+.
4
5+### Nix / devenv
6+
7+`lcr` is also installable as a Nix flake. It builds from source with
8+`pnpm run build` and exposes `bin/lcr` as the `lcr` executable:
9+
10+```sh
11+nix run git+https://git.kilimanjaro.io/local-code-review -- /path/to/repo
12+```
13+
14+To add it to a [devenv](https://devenv.sh/) environment, add the source as an
15+input in `devenv.yaml`:
16+
17+```yaml
18+inputs:
19+ local-code-review:
20+ url: git+https://git.kilimanjaro.io/local-code-review
21+```
22+
23+and the package in `devenv.nix`:
24+
25+```nix
26+{ inputs, pkgs, ... }:
27+{
28+ packages = [ inputs.local-code-review.packages.${pkgs.system}.default ];
29+}
30+```
31+
32+`lcr` uses the `git` / `jj` binaries from your environment (they are not
33+bundled into the package).
34+
35 ## Quick Start
36
37 ```sh
+27,
-0
1@@ -0,0 +1,27 @@
2+{
3+ "nodes": {
4+ "nixpkgs": {
5+ "locked": {
6+ "lastModified": 1790323409,
7+ "narHash": "sha256-VVTPf+Hyd5ebpjBMHmrLMSBIeW6ls48Bqtosj7CNKLA=",
8+ "owner": "NixOS",
9+ "repo": "nixpkgs",
10+ "rev": "e94cb152ed51bd6e24eb4a41f1460252beb52cd2",
11+ "type": "github"
12+ },
13+ "original": {
14+ "owner": "NixOS",
15+ "ref": "nixos-unstable",
16+ "repo": "nixpkgs",
17+ "type": "github"
18+ }
19+ },
20+ "root": {
21+ "inputs": {
22+ "nixpkgs": "nixpkgs"
23+ }
24+ }
25+ },
26+ "root": "root",
27+ "version": 7
28+}
+97,
-0
1@@ -0,0 +1,97 @@
2+{
3+ description = "Local code review tool (lcr) — GitHub PR-like diff view for AI-assisted development";
4+
5+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
7+ outputs =
8+ { self, nixpkgs }:
9+ let
10+ systems = [
11+ "x86_64-linux"
12+ "aarch64-linux"
13+ "x86_64-darwin"
14+ "aarch64-darwin"
15+ ];
16+ forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
17+ pkgJson = builtins.fromJSON (builtins.readFile ./package.json);
18+ in
19+ {
20+ packages = forAllSystems (
21+ system:
22+ let
23+ pkgs = nixpkgs.legacyPackages.${system};
24+ nodejs = pkgs.nodejs;
25+ # NOTE: pnpm 11 ignores manage-package-manager-versions=false and tries
26+ # to self-download the packageManager-pinned pnpm 12.6.0. pnpm 10
27+ # honors the setting and installs this lockfile (lockfileVersion 9.0).
28+ pnpm = pkgs.pnpm_10;
29+ lcr = pkgs.stdenv.mkDerivation (finalAttrs: {
30+ pname = "local-code-review";
31+ version = pkgJson.version;
32+ src = ./.;
33+
34+ pnpmDeps = pkgs.fetchPnpmDeps {
35+ inherit (finalAttrs) pname version src;
36+ pnpm = pnpm;
37+ fetcherVersion = 3;
38+ hash = "sha256-1lXrCe9FN7JXvijG+hxIgT9SuSs83T6fxsvGwwJtAHo=";
39+ };
40+
41+ nativeBuildInputs = [
42+ nodejs
43+ pnpm
44+ pkgs.pnpmConfigHook
45+ pkgs.makeWrapper
46+ ];
47+
48+ buildPhase = ''
49+ runHook preBuild
50+ pnpm run build
51+ runHook postBuild
52+ '';
53+
54+ installPhase = ''
55+ runHook preInstall
56+
57+ # Drop devDependencies so the runtime closure stays small.
58+ # build/ copies only what it needs; node_modules must keep
59+ # runtime deps (ws, simple-git, shiki, open, node-pty).
60+ pnpm prune --prod
61+
62+ mkdir -p $out/lib/lcr
63+ cp -a build bin node_modules package.json $out/lib/lcr/
64+
65+ makeWrapper ${nodejs}/bin/node $out/bin/lcr \
66+ --add-flags "$out/lib/lcr/bin/lcr.js"
67+ runHook postInstall
68+ '';
69+
70+ meta = {
71+ description = pkgJson.description;
72+ homepage = "https://git.kilimanjaro.io/local-code-review";
73+ license = pkgs.lib.licenses.mit;
74+ mainProgram = "lcr";
75+ platforms = systems;
76+ };
77+ });
78+ in
79+ {
80+ inherit lcr;
81+ default = lcr;
82+ }
83+ );
84+
85+ apps = forAllSystems (system: {
86+ default = {
87+ type = "app";
88+ program = "${self.packages.${system}.lcr}/bin/lcr";
89+ };
90+ });
91+
92+ overlays.default = final: prev: {
93+ lcr = self.packages.${final.stdenv.hostPlatform.system}.lcr;
94+ };
95+
96+ formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt);
97+ };
98+}