nix-scribe
A tool that reverse-engineers the current state of a Linux system to generate corresponding NixOS configuration files.
The problem
NixOS, being a Linux distribution managed declaratively, is a strong fit for developers and system administrators. However, its fundamentally different approach to system management makes transitioning to NixOS challenging - especially for new users who are just beginning to learn Nix.
This project aims to simplify and automate the transition from traditional (imperative) Linux distributions to declarative NixOS, by creating a tool nix-scribe to automate the process of writing NixOS configuration files.
The Idea
nix-scribe is essentially a Python script, that scans your current (or specified) system - including configuration files, users, services, packages - and attempts to map this state to NixOS options and definitions.
Installation
You don't have to install the script to run it with nix run. In that case though, you have to specify full command:
nix --extra-experimental-features "nix-command flakes" run --refresh github:Levizor/nix-scribe -- <command line options and arguments>
To install the tool you can use nix profile
nix --extra-experimental-features "nix-command flakes" profile add github:Levizor/nix-scribe
or on NixOS you can add it as a flake:
# flake.nix
inputs = {
nix-scribe.url = "github:Levizor/nix-scribe";
};
# configuration.nix
environment.systemPackages = [
inputs.nix-scribe.packages.${system}.nix-scribe
];
Usage
It's advised to run the script with sudo to allow scanning as much as possible. But the script generally should work without it as well, asking for sudo permissions if required.
Usage: nix-scribe [OPTIONS] [ROOT_PATH]
Arguments:
[ROOT_PATH] Path to the root directory of the system to be scanned [default: /]
Options:
-o, --output PATH Output path for configuration [default: ./nix-config]
-m, --mod-level INTEGER Modularity level: 0 - single file, 1 - category files, 2 - per-module files [default: 0]
-e, --enable-module TEXT Enable module(s) (comma-separated or repeated)
-d, --disable-module TEXT Disable module(s) (comma-separated or repeated)
--only TEXT Run only specified module(s) (comma-separated or repeated)
-p, --plugin TEXT Load external plugin file, directory, or python package
--list-modules List available modules and default status, then exit
--list-modules-tree List available modules in a hierarchical tree, then exit
-v, --verbosity INTEGER Verbosity: 0 - silent, 1 - INFO, 2 - DEBUG [default: 1]
--mod-verbosity INTEGER Module log verbosity: 0 - silent, 1 - INFO, 2 - DEBUG
--no-comment Don't write comments in output files
--confirm Don't ask for confirmation
Run against the current running system:
nix-scribe
Scan a mounted offline root:
nix-scribe /mnt/target-root
Run only specific modules:
nix-scribe --only networking,programs.git,security.sudo
Modularize output into subdirectories:
-m 0- Single file (configuration.nix)-m 1- Top-level category files (services.nix,programs.nix)-m 2- Individual file for each module (programs/git.nix,services/sddm.nix)
nix-scribe -m 2 -o output-dir
Output tree with -m 2:
output-dir
├── configuration.nix
├── boot
│ ├── boot-loader-grub-background.jpg
│ ├── default.nix
│ └── grub.nix
├── environment
│ ├── default.nix
│ └── system_packages.nix
├── programs
│ ├── bash.nix
│ ├── default.nix
│ ├── git.nix
│ └── hyprland.nix
├── security
│ ├── default.nix
│ └── sudo.nix
├── services
│ ├── cosmic.nix
│ ├── default.nix
│ ├── gnome.nix
│ ├── plasma6.nix
│ └── sddm.nix
├── users
│ ├── default.nix
│ ├── groups.nix
│ └── users.nix
└── virtualisation
├── default.nix
└── virtualisation.nix
Contributions
Contributions are welcome. Adding as much modules as possible is the main target of the project.
Read CONTRIBUTING.md to better understand how to do that.
The project is developed as a Bachelors Thesis project for the Polish-Japanese Academy of Information Technology
Metadata
Release files for nix-scribe-py 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| nix_scribe_py-0.1.0.tar.gz | 43.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nix_scribe_py-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 110.9 kB
Release files / nix_scribe_py-0.1.0.tar.gz
| Download URL | nix_scribe_py-0.1.0.tar.gz |
|---|---|
| Size | 43.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d52ddd3bbd5f01d1ccabaa9e2e248a2e0c6efd6a9adeb60e6d7c1a1f3377e45
|
|
BLAKE2b-256 checksum How to use checksums |
21b6877ec7070db9744a4d357e5763a900a8d1cee6498ff1ff3be1044a43b1ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 19, 2026.
Transparency logRelease files / nix_scribe_py-0.1.0-py3-none-any.whl
| Download URL | nix_scribe_py-0.1.0-py3-none-any.whl |
|---|---|
| Size | 67.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bbf9bc838872967127ce85b459918bb621aa8ddad563bf902928bae51c97123
|
|
BLAKE2b-256 checksum How to use checksums |
03036575c9cacf862f00b1faf32b35476292be7fe4aca342420fbf58157cd4e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 19, 2026.
Transparency logSecurity for nix-scribe-py 0.1.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for nix_scribe_py-0.1.0.tar.gz
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 Oct 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.