Re:NixOps – Declarative cloud provisioning and deployment wi...
by FrozenCow on Sunday September 17, 2017 @12:05PM
(#15270238)
Also, for convenience, nested objects/attrsets can be shortened. For instance:
{
a = {
b = {
c = 3;
};
};
}
can be shortened to: {
a.b.c = 3;
}
This is used quite often in NixOS system configuration files. There you'll find lines like: services.openssh.enable = true;
For a list of all system configuration options that NixOS supports by default see (NixOS options)[https://nixos.org/nixos/options.html].
An object (called attrset in nix):
A list: A string: A multi-line string: This defines a lambda with two arguments: It's possible to pattern-match arguments. This accepts an attrset with keys a and b, and maps them to local variables: There are some variations around that like `{ a ? 3 }:` `{ a }@attrs:` and `{ a, ... }`One special type is the path, which has it's own literal that starts with `./`
To load a file, the `import` keyword is being used. In most cases the whole file is a big lambda function, which gets returned by the import.
Once you know that you can start reading nixpkgs and learn about the building blocks to constructs packages.