Hacker symbol

September 23, 2024 ~ 1 min read

Nix generators in lib


There is a list of nice generators in the nixpkgs library.

nix-repl> :l <nixpkgs>
Added 22708 variables.

nix-repl> lib.generators.
lib.generators.mkDconfKeyValue         lib.generators.toDconfINI              lib.generators.toINIWithGlobalSection  lib.generators.toPlist
lib.generators.mkKeyValueDefault       lib.generators.toDhall                 lib.generators.toJSON                  lib.generators.toPretty
lib.generators.mkLuaInline             lib.generators.toGitINI                lib.generators.toKeyValue              lib.generators.toYAML
lib.generators.mkValueStringDefault    lib.generators.toINI                   lib.generators.toLua                   lib.generators.withRecursion

I recently used .toGitINIT combined with xdg.config.<name> to create a git-config file written in nix.


Sebastian BolaƱos

Hi, I'm Sebastian. I'm a software developer from Costa Rica. You can follow me on Twitter. I enjoy working on distributed systems.