Drop flake-parts: zero flake inputs via npins + haskell-flake standalone#627
Open
Drop flake-parts: zero flake inputs via npins + haskell-flake standalone#627
Conversation
Migrate 8 `flake = false` inputs (ema, lvar, heist-extra, unionmount, commonmark-simple, commonmark-wikilink, git-hooks, emanote-template) to npins. These source-only pins don't need the flake machinery and were slowing down `nix run`, `nix develop`, etc. by requiring flake input resolution. The 5 actual flake module inputs (nixpkgs, flake-parts, haskell-flake, fourmolu-nix, nixos-unified) remain as flake inputs.
Inline `sources` bindings in pre-commit.nix and toplevel.nix where they were only used once. Mark npins/default.nix as linguist-generated in .gitattributes.
Move nixpkgs, haskell-flake, fourmolu-nix to npins. Drop nixos-unified entirely and call flake-parts mkFlake directly, replicating the auto-discovery of modules under nix/modules/flake-parts/. Flake inputs: 13 → 1 (flake-parts only).
Use haskell-flake's new standalone evalHaskellProject API (srid/haskell-flake#495) to eliminate flake-parts entirely. All dependencies now come from npins. flake.nix is now plain Nix with zero inputs — no module system overhead. Fourmolu settings moved to fourmolu.yaml (read by fourmolu directly). nixos-unified, flake-parts, and fourmolu-nix dependencies removed. The exported flakeModule for downstream consumers remains unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Zero flake inputs. All 13 flake inputs replaced with npins pins. flake-parts, nixos-unified, and fourmolu-nix dependencies eliminated entirely. Uses haskell-flake's new standalone
evalHaskellProjectAPI (srid/haskell-flake#495) and git-hooks.nix standalonerunfunction. Fourmolu settings moved tofourmolu.yaml(read by fourmolu directly, no nix wrapper needed).The
flake.nixis now plain Nix — no module system, no framework. The exportedflakeModulefor downstream flake-parts consumers is unchanged.Benchmarks (10 runs each,
~/.cache/nixnuked before every cold-cache run):Commit 1 — move
flake = falseinputs to npins (13 → 5 inputs):nix develop -c echonix develop -c echonix run . -- --versionnix run . -- --versionNo difference —
flake = falseinputs have near-zero resolution cost.Commit 2 — move remaining inputs to npins (5 → 1 input, flake-parts only):
nix develop -c echonix develop -c echonix run . -- --versionnix run . -- --versionCommit 3 — drop flake-parts, zero inputs, haskell-flake standalone:
nix develop -c echonix develop -c echonix run . -- --versionnix run . -- --versionObservation: warm-cache performance is identical across all variants (~0.14-0.19s). Cold-cache is ~34% slower with zero inputs because npins uses
builtins.fetchTarballwhich hash-checks each source even when nix-store-cached, whereas flake lock resolution skips this entirely. The ~2.8s cold-cache baseline on master is dominated by the flake-parts/haskell-flake module system evaluation, not input resolution.Methodology:
time nix develop -c echo done/time nix run . -- --version. Cold =rm -rf ~/.cache/nixbefore each run (nix store retained). Warm = consecutive runs. Medians of 10 runs reported.Try it locally