~fgaz/nixpkgs-error-guided-refactor

Error-guided nixpkgs refactor library

4e6a29e WIP: metaWithLib

2 months ago

eb515cc WIP

3 months ago

#Error-guided nixpkgs refactor library

Refactor nix packages by applying a modification, then iterating a fix until all errors are gone.

#API

See the Haddock documentation in lib/NixpkgsErrorGuidedRefactor.hs

#Usage

The executables take from standard input a list of filepath:attrpath to act on, one per line. Example input:

pkgs/by-name/he/hello/package.nix:hello
pkgs/by-name/cm/cmake/package.nix:cmake

They should be run at the root of a clean worktree, and will create a commit for every refactored package.

The tool performs a number of checks to ensure a robust migration:

  • Only actual undefined references are substituted. The tool gets the exact reference position from eval errors.
  • The tool checks that packages evaluate after the change (including meta and passthru).
  • Derivation hashes are compared to ensure they do not change.

#Included refactors