This commit is contained in:
Amy de Buitléir 2025-09-13 14:50:23 +01:00
parent 3330046f0c
commit 9ae6c3f97a
2 changed files with 11 additions and 8 deletions

View file

@ -4738,10 +4738,10 @@ However, you can use any of the flake reference styles defined in <a href="#flak
<p>The <code>hello-nix</code> <a href="https://codeberg.org/mhwombat/hello-nix">repo</a> provides a <code>default.nix</code>.
If the derivation in that file allows us to supply our own package set,
then our flake can call it to build <code>hello nix</code>.
If instead it requires <code>nixpkgs</code>, it is not pure and we cannot use it.</p>
If instead it requires <code>&lt;nixpkgs&gt;</code>, it is not pure and we cannot use it.</p>
</div>
<div class="paragraph">
<p>If the file begins with an expression such as</p>
<p>For example, if the file begins with an expression such as</p>
</div>
<div class="listingblock">
<div class="content">
@ -4761,7 +4761,9 @@ Instead, we have to write our own derivation (see <a href="#devshell-impure">Sec
</div>
</div>
<div class="paragraph">
<p>so we can call it, passing our own package set as an argument (see <a href="#devshell-pure">Section 10.4.6.1, &#8220;If the nix derivation does not require nixpkgs&#8221;</a>).</p>
<p>then it accepts a package set as an argument,
only using <code>&lt;nixpkgs&gt;</code> if no argument is provided.
We can use it directly to build <code>hello-nix</code> (see <a href="#devshell-pure">Section 10.4.6.1, &#8220;If the nix derivation does not require nixpkgs&#8221;</a>).</p>
</div>
<div class="sect4">
<h5 id="devshell-pure">If the nix derivation does not require nixpkgs</h5>
@ -4825,9 +4827,9 @@ Instead, we have to write our own derivation (see <a href="#devshell-impure">Sec
</div>
</div>
<div class="paragraph">
<p>Lines ??? fetches the git repo for <code>hello-nix</code>.
<p>Lines 5-8 fetches the git repo for <code>hello-nix</code>.
However, it is not a flake, so we have to build it;
this is done in line ???.</p>
this is done in line 15.</p>
</div>
<div class="paragraph">
<p>Here&#8217;s a demonstration using the shell.</p>
@ -4835,7 +4837,7 @@ this is done in line ???.</p>
<div class="literalblock">
<div class="content">
<pre class="nowrap">$ hello-nix # this will fail
bash: line 52: hello-nix: command not found
bash: line 53: hello-nix: command not found
$ nix develop
$ hello-nix
Hello from your nix package!</pre>
@ -4927,7 +4929,7 @@ Hello from your flake!</pre>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2025-09-13 14:35:08 IST
Last updated 2025-09-13 14:41:08 IST
</div>
</div>
</body>

View file

@ -64,7 +64,8 @@ $# EOL
[#devshell-impure]
== If the nix derivation requires `nixpkgs`
We need to write the derivation ourselves, using `default.nix` as a model.
In this case, we need to write the derivation ourselves.
We can use `default.nix` as a model.
Line 15 should be replaced with:
[source,nix]