Skip to content

Make Nix commands faster with npins - #753

Draft
srid wants to merge 1 commit into
masterfrom
agent/nix-eval-performance
Draft

Make Nix commands faster with npins#753
srid wants to merge 1 commit into
masterfrom
agent/nix-eval-performance

Conversation

@srid

@srid srid commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Emanote's root flake exposed every dependency through the flake input graph, so routine commands paid to verify that graph and traverse the nixos-unified/flake-parts composition before reaching the output they needed. This PR moves the exact same revisions to npins and evaluates haskell-flake through its standalone library API.

The result is a smaller hot path for both development and execution. Formatting hooks now live in a dedicated .#fmt shell, while runtime outputs skip construction of the Haskell development shell.

Command Mode Before After Change
nix develop -c true warm 0.28s 0.23s -17.9%
nix develop -c true no eval cache 2.77s 2.58s -6.9%
nix develop -c true fresh client cache 3.08s 2.87s -6.8%
nix run . -- --help warm 0.15s 0.11s -26.7%
nix run . -- --help no eval cache 1.68s 1.78s +6.0%
nix run . -- --help fresh client cache 1.97s 1.99s +1.0%

Each number is the median of five runs on x86_64-linux with Nix 2.34.7. The forced uncached app evaluation regression is retained and called out explicitly: the normal repeated app path is 40ms faster, while fresh-client-cache behavior is effectively unchanged. The full Ralph report includes raw samples, methodology, every rejected experiment, and the stopping rule.

The root flake now has zero inputs. flake.lock becomes npins/sources.json; all dependency revisions match the old lock. Private flake-parts modules are replaced by focused standalone modules for the Haskell project, diagrams, hooks, and system outputs. The public Emanote-site flakeModule remains exported and unchanged for downstream consumers. The Playwright and Chrome DevTools shells also read their pins from npins.

Compatibility evidence:

  • apps.x86_64-linux.default.program resolves to the identical baseline store path.
  • Package, app, dev-shell, check, template, Home Manager, downstream module, and Omnix outputs remain available; devShells.fmt is additive.
  • nix flake check --option allow-import-from-derivation true passes all five checks.
  • Default package build, nix run, nix shell, nix develop, tests/shell.nix, and nix/chrome-devtools/shell.nix all pass their smoke tests.

Try it locally

nix develop github:srid/emanote/agent/nix-eval-performance -c true
nix run github:srid/emanote/agent/nix-eval-performance -- --help

Update pins with npins update, or target one pin with npins update nixpkgs-latest.

Generated by Codex (model gpt-5.6-sol).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant