mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-05 18:01:32 +00:00
Deploy PR #1090 preview
This commit is contained in:
parent
9699fb8718
commit
96684b5d4a
1 changed files with 26 additions and 23 deletions
|
@ -682,30 +682,33 @@ used for topologically sorting strings. The DAG type allows the attribute set
|
|||
entries to express dependency relations among themselves. This can, for example,
|
||||
be used to control the order of configuration sections in your <code class="literal">luaConfigRC</code>.</p><p>The below section, mostly taken from the
|
||||
<a class="link" href="https://raw.githubusercontent.com/nix-community/home-manager/master/docs/manual/writing-modules/types.md" target="_top">home-manager manual</a>
|
||||
explains in more detail the overall usage logic of the DAG type.</p><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entryAnywhere" class="title" style="clear: both">entryAnywhere </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">lib.dag.entryAnywhere (value: T) : DagEntry<T></code></p></blockquote></div><p>Indicates that <code class="literal">value</code> can be placed anywhere within the DAG. This is also the
|
||||
default for plain attribute set entries, that is</p><pre><code class="programlisting nix">foo.bar = {
|
||||
a = lib.dag.entryAnywhere 0;
|
||||
explains in more detail the overall usage logic of the DAG type.</p><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entryAnywhere" class="title" style="clear: both">entryAnywhere </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">nvf.lib.nvim.dag.entryAnywhere (value: T) : DagEntry<T></code></p></blockquote></div><p>Indicates that <code class="literal">value</code> can be placed anywhere within the DAG. This is also the
|
||||
default for plain attribute set entries, that is</p><pre><code class="programlisting nix"># For 'nvf' to be available in module's arguments,
|
||||
# it needs to be inherited from imports in the modules array as:
|
||||
# modules = [{ _module.args = { inherit nvf; }; } ...];
|
||||
foo.bar = {
|
||||
a = nvf.lib.nvim.dag.entryAnywhere 0;
|
||||
}
|
||||
</code></pre><p>and</p><pre><code class="programlisting nix">foo.bar = {
|
||||
a = 0;
|
||||
}
|
||||
</code></pre><p>are equivalent.</p>
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="ch-types-dag-entryAfter" class="title" style="clear: both">entryAfter </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">lib.dag.entryAfter (afters: list string) (value: T) : DagEntry<T></code></p></blockquote></div><p>Indicates that <code class="literal">value</code> must be placed <span class="emphasis"><em>after</em></span> each of the attribute names in the
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="ch-types-dag-entryAfter" class="title" style="clear: both">entryAfter </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">nvf.lib.nvim.dag.entryAfter (afters: list string) (value: T) : DagEntry<T></code></p></blockquote></div><p>Indicates that <code class="literal">value</code> must be placed <span class="emphasis"><em>after</em></span> each of the attribute names in the
|
||||
given list. For example</p><pre><code class="programlisting nix">foo.bar = {
|
||||
a = 0;
|
||||
b = lib.dag.entryAfter [ "a" ] 1;
|
||||
b = nvf.lib.nvim.dag.entryAfter [ "a" ] 1;
|
||||
}
|
||||
</code></pre><p>would place <code class="literal">b</code> after <code class="literal">a</code> in the graph.</p>
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="ch-types-dag-entryBefore" class="title" style="clear: both">entryBefore </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">lib.dag.entryBefore (befores: list string) (value: T) : DagEntry<T></code></p></blockquote></div><p>Indicates that <code class="literal">value</code> must be placed <span class="emphasis"><em>before</em></span> each of the attribute names in
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="ch-types-dag-entryBefore" class="title" style="clear: both">entryBefore </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">nvf.lib.nvim.dag.entryBefore (befores: list string) (value: T) : DagEntry<T></code></p></blockquote></div><p>Indicates that <code class="literal">value</code> must be placed <span class="emphasis"><em>before</em></span> each of the attribute names in
|
||||
the given list. For example</p><pre><code class="programlisting nix">foo.bar = {
|
||||
b = lib.dag.entryBefore [ "a" ] 1;
|
||||
b = nvf.lib.nvim.dag.entryBefore [ "a" ] 1;
|
||||
a = 0;
|
||||
}
|
||||
</code></pre><p>would place <code class="literal">b</code> before <code class="literal">a</code> in the graph.</p>
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entryBetween" class="title" style="clear: both">entryBetween </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">lib.dag.entryBetween (befores: list string) (afters: list string) (value: T) : DagEntry<T></code></p></blockquote></div><p>Indicates that <code class="literal">value</code> must be placed <span class="emphasis"><em>before</em></span> the attribute names in the first
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entryBetween" class="title" style="clear: both">entryBetween </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">nvf.lib.nvim.dag.entryBetween (befores: list string) (afters: list string) (value: T) : DagEntry<T></code></p></blockquote></div><p>Indicates that <code class="literal">value</code> must be placed <span class="emphasis"><em>before</em></span> the attribute names in the first
|
||||
list and <span class="emphasis"><em>after</em></span> the attribute names in the second list. For example</p><pre><code class="programlisting nix">foo.bar = {
|
||||
a = 0;
|
||||
c = lib.dag.entryBetween [ "b" ] [ "a" ] 2;
|
||||
c = nvf.lib.nvim.dag.entryBetween [ "b" ] [ "a" ] 2;
|
||||
b = 1;
|
||||
}
|
||||
</code></pre><p>would place <code class="literal">c</code> before <code class="literal">b</code> and after <code class="literal">a</code> in the graph.</p><p>There are also a set of functions that generate a DAG from a list. These are
|
||||
|
@ -713,42 +716,42 @@ 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 <code class="literal">tag</code> as argument and the DAG entries will be named
|
||||
<code class="literal">${tag}-${index}</code>.</p>
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entriesAnywhere" class="title" style="clear: both">entriesAnywhere </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">lib.dag.entriesAnywhere (tag: string) (values: [T]) : Dag<T></code></p></blockquote></div><p>Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
For example</p><pre><code class="programlisting nix">foo.bar = lib.dag.entriesAnywhere "a" [ 0 1 ];
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entriesAnywhere" class="title" style="clear: both">entriesAnywhere </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">nvf.lib.nvim.dag.entriesAnywhere (tag: string) (values: [T]) : Dag<T></code></p></blockquote></div><p>Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
For example</p><pre><code class="programlisting nix">foo.bar = nvf.lib.nvim.dag.entriesAnywhere "a" [ 0 1 ];
|
||||
</code></pre><p>is equivalent to</p><pre><code class="programlisting nix">foo.bar = {
|
||||
a-0 = 0;
|
||||
a-1 = lib.dag.entryAfter [ "a-0" ] 1;
|
||||
a-1 = nvf.lib.nvim.dag.entryAfter [ "a-0" ] 1;
|
||||
}
|
||||
</code></pre>
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entriesAfter" class="title" style="clear: both">entriesAfter </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">lib.dag.entriesAfter (tag: string) (afters: list string) (values: [T]) : Dag<T></code></p></blockquote></div><p>Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entriesAfter" class="title" style="clear: both">entriesAfter </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">nvf.lib.nvim.dag.entriesAfter (tag: string) (afters: list string) (values: [T]) : Dag<T></code></p></blockquote></div><p>Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
The list of values are placed are placed <span class="emphasis"><em>after</em></span> each of the attribute names in
|
||||
<code class="literal">afters</code>. For example</p><pre><code class="programlisting nix">foo.bar =
|
||||
{ b = 0; } // lib.dag.entriesAfter "a" [ "b" ] [ 1 2 ];
|
||||
{ b = 0; } // nvf.lib.nvim.dag.entriesAfter "a" [ "b" ] [ 1 2 ];
|
||||
</code></pre><p>is equivalent to</p><pre><code class="programlisting nix">foo.bar = {
|
||||
b = 0;
|
||||
a-0 = lib.dag.entryAfter [ "b" ] 1;
|
||||
a-1 = lib.dag.entryAfter [ "a-0" ] 2;
|
||||
a-0 = nvf.lib.nvim.dag.entryAfter [ "b" ] 1;
|
||||
a-1 = nvf.lib.nvim.dag.entryAfter [ "a-0" ] 2;
|
||||
}
|
||||
</code></pre>
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entriesBefore" class="title" style="clear: both">entriesBefore </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">lib.dag.entriesBefore (tag: string) (befores: list string) (values: [T]) : Dag<T></code></p></blockquote></div><p>Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entriesBefore" class="title" style="clear: both">entriesBefore </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">nvf.lib.nvim.dag.entriesBefore (tag: string) (befores: list string) (values: [T]) : Dag<T></code></p></blockquote></div><p>Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
The list of values are placed <span class="emphasis"><em>before</em></span> each of the attribute names in <code class="literal">befores</code>.
|
||||
For example</p><pre><code class="programlisting nix">foo.bar =
|
||||
{ b = 0; } // lib.dag.entriesBefore "a" [ "b" ] [ 1 2 ];
|
||||
{ b = 0; } // nvf.lib.nvim.dag.entriesBefore "a" [ "b" ] [ 1 2 ];
|
||||
</code></pre><p>is equivalent to</p><pre><code class="programlisting nix">foo.bar = {
|
||||
b = 0;
|
||||
a-0 = 1;
|
||||
a-1 = lib.dag.entryBetween [ "b" ] [ "a-0" ] 2;
|
||||
a-1 = nvf.lib.nvim.dag.entryBetween [ "b" ] [ "a-0" ] 2;
|
||||
}
|
||||
</code></pre>
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entriesBetween" class="title" style="clear: both">entriesBetween </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">lib.dag.entriesBetween (tag: string) (befores: list string) (afters: list string) (values: [T]) : Dag<T></code></p></blockquote></div><p>Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
</div><div class="section"> <div class="titlepage"> <div> <div> <h2 id="sec-types-dag-entriesBetween" class="title" style="clear: both">entriesBetween </h2> </div> </div></div><div class="blockquote"><blockquote class="blockquote"><p><code class="literal">nvf.lib.nvim.dag.entriesBetween (tag: string) (befores: list string) (afters: list string) (values: [T]) : Dag<T></code></p></blockquote></div><p>Creates a DAG with the given values with each entry labeled using the given tag.
|
||||
The list of values are placed <span class="emphasis"><em>before</em></span> each of the attribute names in <code class="literal">befores</code>
|
||||
and <span class="emphasis"><em>after</em></span> each of the attribute names in <code class="literal">afters</code>. For example</p><pre><code class="programlisting nix">foo.bar =
|
||||
{ b = 0; c = 3; } // lib.dag.entriesBetween "a" [ "b" ] [ "c" ] [ 1 2 ];
|
||||
{ b = 0; c = 3; } // nvf.lib.nvim.dag.entriesBetween "a" [ "b" ] [ "c" ] [ 1 2 ];
|
||||
</code></pre><p>is equivalent to</p><pre><code class="programlisting nix">foo.bar = {
|
||||
b = 0;
|
||||
c = 3;
|
||||
a-0 = lib.dag.entryAfter [ "c" ] 1;
|
||||
a-1 = lib.dag.entryBetween [ "b" ] [ "a-0" ] 2;
|
||||
a-0 = nvf.lib.nvim.dag.entryAfter [ "c" ] 1;
|
||||
a-1 = nvf.lib.nvim.dag.entryBetween [ "b" ] [ "a-0" ] 2;
|
||||
}
|
||||
</code></pre>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue