From 01831a129c995148563260ea8e6a557b6640dc93 Mon Sep 17 00:00:00 2001 From: rycee Date: Mon, 5 Jun 2023 21:09:44 +0000 Subject: [PATCH] deploy: 28614ed7a1e3ace824c122237bdc0e5e0b62c5c3 --- index.html | 60 ++++++++++++++++++++++++++++++++++++++++++++++------ options.html | 2 +- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index f3efbc9e..82d915c1 100644 --- a/index.html +++ b/index.html @@ -369,11 +369,11 @@ is similar to that of NixOS. The flake.nix would be }; }

and it is also rebuilt with the nix-darwin generations. The rebuild command here may be darwin-rebuild switch --flake <flake-uri>.

You can use the above flake.nix as a template in ~/.config/darwin by

$ nix flake new ~/.config/darwin -t github:nix-community/home-manager#nix-darwin

Chapter 4. Writing Home Manager Modules

The module system in Home Manager is based entirely on the NixOS module system so we will here only highlight aspects that are specific for Home Manager. For information about the module system as such please refer to the Writing NixOS Modules chapter of the NixOS manual.

4.1. Option Types

Overall the basic option types are the same in Home Manager as NixOS. A few Home Manager options, however, make use of custom types that are worth describing in more detail. These are the option types dagOf and gvariant that are used, for example, by programs.ssh.matchBlocks and dconf.settings.

-hm.types.dagOf +hm.types.dagOf

Options of this type have attribute sets as values where each member is a node in a directed acyclic graph (DAG). This allows the attribute set entries to express dependency relations among themselves. This can, for example, be used to control the order of match blocks in a OpenSSH client configuration or the order of activation script blocks in home.activation.

A number of functions are provided to create DAG nodes. The functions are shown below with examples using an option foo.bar of type hm.types.dagOf types.int.

-hm.dag.entryAnywhere (value: T) +hm.dag.entryAnywhere (value: T) : DagEntry<T>

Indicates that value can be placed anywhere within the DAG. This is also the default for plain attribute set entries, that is

foo.bar = {
@@ -381,28 +381,76 @@ Indicates that value can be placed anywhere within
 }

and

foo.bar = {
   a = 0;
 }

are equivalent.

-hm.dag.entryAfter (afters: list string) (value: T) +hm.dag.entryAfter (afters: list string) (value: T) : DagEntry<T>

Indicates that value must be placed after each of the attribute names in the given list. For example

foo.bar = {
   a = 0;
   b = hm.dag.entryAfter [ "a" ] 1;
 }

would place b after a in the graph.

-hm.dag.entryBefore (befores: list string) (value: T) +hm.dag.entryBefore (befores: list string) (value: T) : DagEntry<T>

Indicates that value must be placed before each of the attribute names in the given list. For example

foo.bar = {
   b = hm.dag.entryBefore [ "a" ] 1;
   a = 0;
 }

would place b before a in the graph.

-hm.dag.entryBetween (befores: list string) (afters: list string) (value: T) +hm.dag.entryBetween (befores: list string) (afters: list string) (value: T) : DagEntry<T>

Indicates that value must be placed before the attribute names in the first list and after the attribute names in the second list. For example

foo.bar = {
   a = 0;
   c = hm.dag.entryBetween [ "b" ] [ "a" ] 2;
   b = 1;
-}

would place c before b and after a in the graph.

+}

would place c before b and after a in the graph.

There are also a set of functions that generate a DAG from a list. +These are convenient when you just want to have a linear list of DAG entries, +without having to manually enter the relationship between each entry. +Each of these functions take a tag as argument and the DAG entries will be named ${tag}-${index}.

+hm.dag.entriesAnywhere (tag: string) (values: [T]) : Dag<T> +

+Creates a DAG with the given values with each entry labeled using the given tag. For example +

foo.bar = hm.dag.entriesAnywhere "a" [ 0 1 ];

is equivalent to

foo.bar = {
+  a-0 = 0;
+  a-1 = hm.dag.entryAfter [ "a-0" ] 1;
+}
+hm.dag.entriesAfter (tag: string) (afters: list string) (values: [T]) : Dag<T> +

+Creates a DAG with the given values with each entry labeled using the given tag. +The list of values are placed are placed after each of the attribute names in afters. +For example +

foo.bar =
+  { b = 0; }
+  // hm.dag.entriesAfter "a" [ "b" ] [ 1 2 ];

is equivalent to

foo.bar = {
+  b = 0;
+  a-0 = hm.dag.entryAfter [ "b" ] 1;
+  a-1 = hm.dag.entryAfter [ "a-0" ] 2;
+}
+hm.dag.entriesBefore (tag: string) (befores: list string) (values: [T]) : Dag<T> +

+Creates a DAG with the given values with each entry labeled using the given tag. +The list of values are placed before each of the attribute names in befores. +For example +

foo.bar =
+  { b = 0; }
+  // hm.dag.entriesBefore "a" [ "b" ] [ 1 2 ];

is equivalent to

foo.bar = {
+  b = 0;
+  a-0 = 1;
+  a-1 = hm.dag.entryBetween [ "b" ] [ "a-0" ] 2;
+}
+hm.dag.entriesBetween (tag: string) (befores: list string) (afters: list string) (values: [T]) : Dag<T> +

+Creates a DAG with the given values with each entry labeled using the given tag. +The list of values are placed before each of the attribute names in befores +and after each of the attribute names in afters. +For example +

foo.bar =
+  { b = 0; c = 3; }
+  // hm.dag.entriesBetween "a" [ "b" ] [ "c" ] [ 1 2 ];

is equivalent to

foo.bar = {
+  b = 0;
+  c = 3;
+  a-0 = hm.dag.entryAfter [ "c" ] 1;
+  a-1 = hm.dag.entryBetween [ "b" ] [ "a-0" ] 2;
+}
hm.types.gvariant

This type is useful for options representing GVariant values. The type accepts all primitive GVariant types as well as arrays, tuples, “maybe” types, and dictionaries. diff --git a/options.html b/options.html index d0941c0f..d2891a21 100644 --- a/options.html +++ b/options.html @@ -5801,7 +5801,7 @@ shown in the example.

See ssh_config(5) -for more information.

Type: list or DAG of submodules

Default: { }

Example:

{
+for more information.

Type: DAG of submodule

Default: { }

Example:

{
   "john.example.com" = {
     hostname = "example.com";
     user = "john";