mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2026-02-22 12:55:21 +08:00
better flake style
This commit is contained in:
parent
2f4fd48e46
commit
82c570aa36
3 changed files with 4385 additions and 4489 deletions
23
index.html
23
index.html
|
|
@ -237,9 +237,8 @@ pre.pygments .tok-il { color: #666666 } /* Literal.Number.Integer.Long */
|
|||
<li><a href="#_a_simple_bash_script">9.1.1. A simple Bash script</a></li>
|
||||
<li><a href="#_defining_the_development_environment">9.1.2. Defining the development environment</a></li>
|
||||
<li><a href="#define-package">9.1.3. Defining the package</a></li>
|
||||
<li><a href="#config-nixpkgs">9.1.4. Configuring Nixpkgs</a></li>
|
||||
<li><a href="#multi-arch">9.1.5. Supporting multiple architectures</a></li>
|
||||
<li><a href="#_a_few_more_improvements">9.1.6. A few more improvements</a></li>
|
||||
<li><a href="#multi-arch">9.1.4. Supporting multiple architectures</a></li>
|
||||
<li><a href="#_a_few_more_improvements">9.1.5. A few more improvements</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_haskell">9.2. Haskell</a>
|
||||
|
|
@ -350,7 +349,7 @@ and as a downloadable
|
|||
<a href="https://codeberg.org/mhwombat/nix-book/raw/branch/pages/wombats-book-of-nix.pdf">PDF</a>.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p><em>Last updated 2025-10-13 at 19:56:23 IST</em>.</p>
|
||||
<p><em>Last updated 2025-10-13 at 19:59:52 IST</em>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -3873,7 +3872,7 @@ So far, the <code>outputs</code> section only defines a development environment
|
|||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The repetition of <code>x86_64-linux</code> is undesirable.
|
||||
In <a href="#multi-arch">Section 9.1.5, “Supporting multiple architectures”</a> we will refactor the code to eliminate some duplication and make it more readable.
|
||||
In <a href="#multi-arch">Section 9.1.4, “Supporting multiple architectures”</a> we will refactor the code to eliminate some duplication and make it more readable.
|
||||
For now, we will stick with the straightforward version.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
|
|
@ -4074,11 +4073,7 @@ we would have an error about the file being missing.</p>
|
|||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="config-nixpkgs">9.1.4. Configuring Nixpkgs</h4>
|
||||
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="multi-arch">9.1.5. Supporting multiple architectures</h4>
|
||||
<h4 id="multi-arch">9.1.4. Supporting multiple architectures</h4>
|
||||
<div class="paragraph">
|
||||
<p>Congratulations!
|
||||
Our package is popular, and people want to run it on <code>aarch64-linux</code> systems.
|
||||
|
|
@ -4448,7 +4443,7 @@ in order to reassure yourself that the definitions are equivalent.</p>
|
|||
<div class="literalblock">
|
||||
<div class="content">
|
||||
<pre class="nowrap">$ git commit -am "refactored the flake"
|
||||
[master (root-commit) cdb1858] refactored the flake
|
||||
[master (root-commit) ba27ec5] refactored the flake
|
||||
3 files changed, 70 insertions(+)
|
||||
create mode 100755 cow-hello.sh
|
||||
create mode 100644 flake.lock
|
||||
|
|
@ -4466,7 +4461,7 @@ $ nix run
|
|||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_a_few_more_improvements">9.1.6. A few more improvements</h4>
|
||||
<h4 id="_a_few_more_improvements">9.1.5. A few more improvements</h4>
|
||||
<div class="paragraph">
|
||||
<p>I took some shortcuts in the flake definitions up to this point, just to keep it simple.
|
||||
Normally a flake has both a <code>packages</code> section and an <code>apps</code> section.
|
||||
|
|
@ -4643,7 +4638,7 @@ and
|
|||
<div class="literalblock">
|
||||
<div class="content">
|
||||
<pre class="nowrap">$ git commit -am "refactored the flake"
|
||||
[master ba19983] refactored the flake
|
||||
[master 4c38386] refactored the flake
|
||||
1 file changed, 21 insertions(+), 3 deletions(-)
|
||||
$ nix run
|
||||
evaluation warning: getExe: Package "cow-hello.sh" does not have the meta.mainProgram attribute. We'll assume that the main program has the same name for now, but this behavior is deprecated, because it leads to surprising errors when the assumption does not hold. If the package has a main program, please set `meta.mainProgram` in its definition to make this warning go away. Otherwise, if the package does not have a main program, or if you don't control its definition, use getExe' to specify the name to the program, such as lib.getExe' foo "bar".
|
||||
|
|
@ -7117,7 +7112,7 @@ Hello from your flake!</pre>
|
|||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2025-10-13 19:56:23 IST
|
||||
Last updated 2025-10-13 19:59:52 IST
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue