Alternative language

Nix-lang is a Domain-Specific-Language. It’s not a general purpose.

Most of the information you’re looking for is probably implemented in nixpkgs, and not in nix-lang. Nix-lang really only offers the core datatypes, keywords and related programming constructs, operators, and items under builtins. Everything else is implemented within nixpkgs.

I see so you are saying nix lang has no standard way of defining function documentation, module documentation and so. The way I see it is nixpkgs defines many of the library functions that are helpful to build packages in different languages but these are undocumented often and short of reading their usage or source its hard to understand how to use them

you will also likely be interested in nixdoc package.

As well nix-doc https://www.reddit.com/r/NixOS/comments/i4pnsj/nixdoc_a_nix_function_documentation_search_tool/

2 Likes

module documentation is auto generated, if on nixos, you just do man configuration.nix for nixos options, man home-configuration.nix for home-manager. I’m assuming nixpkgs-darwin has something similar.

This is probably me being pedantic. But the lib functions, don’t know anything about derivations, they are only helpers around evaluating expressions. “functions that are helpful to build packages in different languages” are usually referred to as mkDerivation helpers, and they are usually documented here: Nixpkgs 23.11 manual | Nix & NixOS

Agreed, improvement to docs are always welcome :slight_smile:

1 Like

Looks quite useful thanks for sharing, greater visibility for the existing docs is nice to have.

related: GitHub - tweag/nickel: Better configuration for less

3 Likes

I am excited by the idea of using TOML.

Appearently this has been around for quite some time, but has never really taken off.

There is a thread that is also showing an interesting way, how Idris does source TOML files, but there has never been any further comment on it.

I think TOML is far more readable, and could particulary draw in people from Rust, Python and other communities, where it is popular, or even the default choice.

It could remove the long standing issue, of people being scared of Nix as a language.

You could use TOML already with just a little generic code using the builtins.fromTOML function.

This would work fine with any pure value options but not for options that require the use of functions or derivations as neither of those exist in TOML. They’re quite essential for the purposes of NixOS though, so I don’t think you’d get very far with a TOML-only config.

5 Likes