An opinionated Nix serializer, using the serde framework.
ser_nix exists to allow generation of human readable Nix code from Rust that
can be included in NixOS configurations, devShells, etc.
[!NOTE] This is not a deserializer, for that look into tvix_serde (which only implements the deserializer half). There is no guarantee of compatibility between the two.
Example
use Serialize;
use to_string;
let cm = Person ;
let serialized = to_string.unwrap;
let expected = "{\n name = \"John Doe\";\n age = 65;\n}".to_string;
assert_eq!;
see the docs for more.
Design philosophy
This crate is intentionally opinionated in the way it produces output. Unlike other crates in the Serde ecosystem, there is no "pretty" serialization and "normal" serialization; output is formatted/pretty by default.
Contributing
Contributions, issues, etc. are all welcome and encouraged.
Please ensure code is formatted with rustfmt prior to submitting PRs.
License
ser_nix is licensed under the MIT license.