Nix-manipulator: Python library to manipulate Nix code with ease
UA2.118 (Henriot) | Day 1 | 18:15 - 18:20 | Speakers: Hugo Herter
Abstract
Nima, the Nix Manipulator, is a new Python library and collection of tools for parsing, manipulating and reconstructing Nix source code.
This presentation will introduce the project, its original goals, key features, and practical applications. It will explore the tradeoffs and decisions made during development and demonstrate how to use its various features.
Context
Started during SaltSprint 2025, Nima 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.
Goals
- Ease of use.
- High-level abstractions make manipulating expressions easy.
- Preserving formatting and comments in code that respects RFC-166.
Eccentric formatting that does not respect RFC-166 and would add unnecessary complexity may not be preserved.
Targeted applications
- Updating values in Nix code by hand, scripts, pipelines, and frameworks.
- Writing refactoring tools.
- Interactive modifications from a REPL.
Foundations
Nima builds on tree‑sitter, a multilingual concrete‑syntax AST, with the tree‑sitter‑nix grammar providing lossless parsing of Nix files.
Project status
The project is still in early‑stage:
- Most Nix syntax is supported, but not all everything yet.
- Test-driven approach prevents regressions.
- CLI and API stability is still evolving.
Links
Source: https://github.com/hoh/nix-manipulator Announcement: https://discourse.nixos.org/t/announcing-nix-manipulator-nima-structured-edits-for-nix-that-keep-formatting/68513/11
Speakers
Passionate about free software and the interconnection of technologies since his first FOSDEM in 2004, Hugo never stopped hacking around the possibilities offered by Python and Linux and sharing his passion.
He founded OKESO in 2016 as a company focused on providing expert advice, training and implementation on Software Engineering and Data Science, with a focus on Free and Open-Source technologies, Digital Sovereignty and Privacy.
Links
External Links
Notice: The placeholder video image is licensed under CC BY-SA 4.0. The original image can be found hereChanges made to the image are: Cropped the image to a new ratio, part of the image was cut off.
