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 CLI and 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
- CLI and 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.
CLI Usage
Nix-manipulator provides a command-line interface for common operations:
Set a value in a Nix file
nima set -f package.nix version '"1.2.3"'
Set a boolean value
nima set -f package.nix doCheck true
Remove an attribute
nima rm -f package.nix doCheck
Test/validate that a Nix file can be parsed
nima test -f package.nix
Metadata
Release files for nix-manipulator 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nix_manipulator-0.1.3.tar.gz | 28.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nix_manipulator-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.4 kB
Release files / nix_manipulator-0.1.3.tar.gz
| Download URL | nix_manipulator-0.1.3.tar.gz |
|---|---|
| Size | 28.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd2291fc6f1150437ec34dfcba16ed971bdb116537c13827f6e6d99a802fcde8
|
|
BLAKE2b-256 checksum How to use checksums |
28b4de70d2e9ac9c7b8b38c1bcb9df5feb2e6c9532d6cd16bbd84b620f9f0285
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2025.
Transparency logRelease files / nix_manipulator-0.1.3-py3-none-any.whl
| Download URL | nix_manipulator-0.1.3-py3-none-any.whl |
|---|---|
| Size | 45.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de7fade972daaf10cf2282397b03c9f6bdd144b2ffe959c93c99636e2a864153
|
|
BLAKE2b-256 checksum How to use checksums |
d9b42aca65a41b5b1c44c8488463307587d26b371b062b7048f9b1fe2c796008
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2025.
Transparency log