Skip to content

Vortriz/nix-manipulator

 
 

Nix-manipulator (Nima)

A Python library and tools for parsing, manipulating, and reconstructing Nix source code.

Overview

Started during SaltSprint 2025, Nix-manipulator aims to fill the absence of tools for easily updating and editing Nix code. Popular tools such as nix-update rely on simple string replacement or regular expressions for updating Nix code.

Features and Goals

  • Ease of use - Simple API for common operations.
  • High-level abstractions make manipulating expressions easy.
  • Preserving formatting and comments in code that respects RFC-166.

Non-goals

  • Preserving eccentric formatting that does not respect RFC-166 and would add unnecessary complexity.

Targeted applications

  • Updating values in Nix code by hand, scripts, pipelines, and frameworks.
  • Writing refactoring tools.
  • Interactive modifications from a REPL.

Foundations

Nix-manipulator leverages tree-sitter , a multilingual concrete-syntax AST, and its Nix grammar tree-sitter-nix.

Project Status

The project is still in early-stage:

  • Not all Nix syntax is supported yet
  • Test-driven approach prevents regressions
  • API are still evolving and subject to change
  • 28991 / 39573 (73.26%) Nix files from nixpkgs could be parsed and reproduced

Target Audience

Intermediate Nix users and developers working with Nix code manipulation.

About

Parse, manipulate, and reconstruct Nix source code with high-level abstractions.

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
GPL-3.0
COPYING
LGPL-3.0
COPYING.LESSER

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 94.9%
  • Nix 5.1%