1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

docs: Mention GVariant format strings

This commit is contained in:
Jan Tojnar 2023-05-06 17:12:41 +02:00 committed by Robert Helgesson
parent a0ddb8af40
commit 13d666dd68
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -83,7 +83,7 @@ This type is useful for options representing {gvariant-description}[GVariant] va
Some Nix values are automatically coerced to matching GVariant value but the GVariant model is richer so you may need to use one of the provided constructor functions. Examples assume an option `foo.bar` of type `hm.types.gvariant`.
+
[[sec-option-types-gvariant-mkBoolean]]`hm.gvariant.mkBoolean (v: bool)`:::
Takes a Nix value `v` to a GVariant `boolean` value. Note, Nix booleans are automatically coerced using this function. That is,
Takes a Nix value `v` to a GVariant `boolean` value (GVariant format string `b`). Note, Nix booleans are automatically coerced using this function. That is,
+
[source,nix]
----
@ -97,7 +97,7 @@ is equivalent to
foo.bar = true;
----
[[sec-option-types-gvariant-mkString]]`hm.gvariant.mkString (v: string)`:::
Takes a Nix value `v` to a GVariant `string` value. Note, Nix strings are automatically coerced using this function. That is,
Takes a Nix value `v` to a GVariant `string` value (GVariant format string `s`). Note, Nix strings are automatically coerced using this function. That is,
+
[source,nix]
----
@ -111,15 +111,15 @@ is equivalent to
foo.bar = "a string";
----
[[sec-option-types-gvariant-mkObjectpath]]`hm.gvariant.mkObjectpath (v: string)`:::
Takes a Nix value `v` to a GVariant `objectpath` value.
Takes a Nix value `v` to a GVariant `objectpath` value (GVariant format string `o`).
[[sec-option-types-gvariant-mkUchar]]`hm.gvariant.mkUchar (v: string)`:::
Takes a Nix value `v` to a GVariant `uchar` value.
Takes a Nix value `v` to a GVariant `uchar` value (GVariant format string `y`).
[[sec-option-types-gvariant-mkInt16]]`hm.gvariant.mkInt16 (v: int)`:::
Takes a Nix value `v` to a GVariant `int16` value.
Takes a Nix value `v` to a GVariant `int16` value (GVariant format string `n`).
[[sec-option-types-gvariant-mkUint16]]`hm.gvariant.mkUint16 (v: int)`:::
Takes a Nix value `v` to a GVariant `uint16` value.
Takes a Nix value `v` to a GVariant `uint16` value (GVariant format string `q`).
[[sec-option-types-gvariant-mkInt32]]`hm.gvariant.mkInt32 (v: int)`:::
Takes a Nix value `v` to a GVariant `int32` value. Note, Nix integers are automatically coerced using this function. That is,
Takes a Nix value `v` to a GVariant `int32` value (GVariant format string `i`). Note, Nix integers are automatically coerced using this function. That is,
+
[source,nix]
----
@ -133,13 +133,13 @@ is equivalent to
foo.bar = 7;
----
[[sec-option-types-gvariant-mkUint32]]`hm.gvariant.mkUint32 (v: int)`:::
Takes a Nix value `v` to a GVariant `uint32` value.
Takes a Nix value `v` to a GVariant `uint32` value (GVariant format string `u`).
[[sec-option-types-gvariant-mkInt64]]`hm.gvariant.mkInt64 (v: int)`:::
Takes a Nix value `v` to a GVariant `int64` value.
Takes a Nix value `v` to a GVariant `int64` value (GVariant format string `x`).
[[sec-option-types-gvariant-mkUint64]]`hm.gvariant.mkUint64 (v: int)`:::
Takes a Nix value `v` to a GVariant `uint64` value.
Takes a Nix value `v` to a GVariant `uint64` value (GVariant format string `t`).
[[sec-option-types-gvariant-mkDouble]]`hm.gvariant.mkDouble (v: double)`:::
Takes a Nix value `v` to a GVariant `double` value. Note, Nix floats are automatically coerced using this function. That is,
Takes a Nix value `v` to a GVariant `double` value (GVariant format string `d`). Note, Nix floats are automatically coerced using this function. That is,
+
[source,nix]
----
@ -154,24 +154,24 @@ foo.bar = 3.14;
----
+
[[sec-option-types-gvariant-mkArray]]`hm.gvariant.mkArray type elements`:::
Builds a GVariant array containing the given list of elements, where each element is a GVariant value of the given type. The `type` value can be constructed using
Builds a GVariant array containing the given list of elements, where each element is a GVariant value of the given type (GVariant format string `a${type}`). The `type` value can be constructed using
+
--
- `hm.gvariant.type.string`
- `hm.gvariant.type.boolean`
- `hm.gvariant.type.uchar`
- `hm.gvariant.type.int16`
- `hm.gvariant.type.uint16`
- `hm.gvariant.type.int32`
- `hm.gvariant.type.uint32`
- `hm.gvariant.type.int64`
- `hm.gvariant.type.uint64`
- `hm.gvariant.type.double`
- `hm.gvariant.type.variant`
- `hm.gvariant.type.arrayOf type`
- `hm.gvariant.type.maybeOf type`
- `hm.gvariant.type.tupleOf types`
- `hm.gvariant.type.dictionaryEntryOf types`
- `hm.gvariant.type.string` (GVariant format string `s`)
- `hm.gvariant.type.boolean` (GVariant format string `b`)
- `hm.gvariant.type.uchar` (GVariant format string `y`)
- `hm.gvariant.type.int16` (GVariant format string `n`)
- `hm.gvariant.type.uint16` (GVariant format string `q`)
- `hm.gvariant.type.int32` (GVariant format string `i`)
- `hm.gvariant.type.uint32` (GVariant format string `u`)
- `hm.gvariant.type.int64` (GVariant format string `x`)
- `hm.gvariant.type.uint64` (GVariant format string `t`)
- `hm.gvariant.type.double` (GVariant format string `d`)
- `hm.gvariant.type.variant` (GVariant format string `v`)
- `hm.gvariant.type.arrayOf type` (GVariant format string `a${type}`)
- `hm.gvariant.type.maybeOf type` (GVariant format string `m${type}`)
- `hm.gvariant.type.tupleOf types` (GVariant format string `(${lib.concatStrings types})`)
- `hm.gvariant.type.dictionaryEntryOf [keyType valueType]` (GVariant format string `{${keyType}${valueType}}`)
--
+
where `type` and `types` are themselves a type and list of types, respectively.
@ -180,16 +180,16 @@ where `type` and `types` are themselves a type and list of types, respectively.
An alias of `hm.gvariant.mkArray type []`.
+
[[sec-option-types-gvariant-mkNothing]]`hm.gvariant.mkNothing type`:::
Builds a GVariant maybe value whose (non-existent) element is of the given type. The `type` value is constructed as described for the `mkArray` function above.
Builds a GVariant maybe value (GVariant format string `m${type}`) whose (non-existent) element is of the given type. The `type` value is constructed as described for the `mkArray` function above.
+
[[sec-option-types-gvariant-mkJust]]`hm.gvariant.mkJust element`:::
Builds a GVariant maybe value containing the given GVariant element.
Builds a GVariant maybe value (GVariant format string `m${element.type}`) containing the given GVariant element.
+
[[sec-option-types-gvariant-mkTuple]]`hm.gvariant.mkTuple elements`:::
Builds a GVariant tuple containing the given list of elements, where each element is a GVariant value.
+
[[sec-option-types-gvariant-mkVariant]]`hm.gvariant.mkVariant element`:::
Builds a GVariant variant which contains the value of a GVariant element.
Builds a GVariant variant (GVariant format string `v`) which contains the value of a GVariant element.
+
[[sec-option-types-gvariant-mkDictionaryEntry]]`hm.gvariant.mkDictionaryEntry elements`:::
Builds a GVariant dictionary entry containing the given list of elements, where each element is a GVariant value.
[[sec-option-types-gvariant-mkDictionaryEntry]]`hm.gvariant.mkDictionaryEntry [key value]`:::
Builds a GVariant dictionary entry containing the given list of elements (GVariant format string `{${key.type}${value.type}}`), where each element is a GVariant value.