NixService

One services.<name> block: the technical-configuration half of the model.

Note

Mirrors the two NixOS conventions:

  • enable - declared upstream with mkEnableOption.

  • arbitrary further options, including the RFC 42 settings freeform attribute set which maps onto the service’s own configuration file.

Option order is preserved so the emitted nix stays diff-stable between runs.

public sealed class NixService

1. Constructors

1.1. NixService(string, bool)

Creates a service block.

public NixService(string name, bool enable = true)
Table 1. Parameters
Name Type Description

name

string

Option path under services., e.g. nginx or kubo.

enable

bool

Value for services.<name>.enable.

2. Properties

2.1. Enable

Whether services.<name>.enable is set to true.

public bool Enable { get; }

2.2. Name

Option path under services..

public string Name { get; }

2.3. Options

Declared options besides enable, in declaration order.

public IReadOnlyList<KeyValuePair<string, NixValue>> Options { get; }

3. Methods

3.1. Render(int)

Renders the whole services.<name> block as nix lines.

public string Render(int indent = 1)
Table 2. Parameters
Name Type Description

indent

int

Indentation depth in two-space units.

Returns: string — Nix source lines for this service.

3.2. WithOption(string, NixValue)

Sets one option below this service, e.g. settings or openFirewall.

public NixService WithOption(string option, NixValue value)
Table 3. Parameters
Name Type Description

option

string

Option name relative to services.<name>.

value

NixValue

Option value.

Returns: NixService — This service, for chaining.