This commit is contained in:
Amy de Buitléir 2025-09-04 17:24:13 +01:00
parent 4203bfd0d9
commit 959bc9c12f
3 changed files with 200 additions and 25 deletions

View file

@ -4327,10 +4327,8 @@ hello-flake
<div class="literalblock">
<div class="content">
<pre class="nowrap">$ cowsay "Moo!"
bash: line 32: cowsay: command not found
$ nix develop
path '/home/amy/codeberg/nix-book/source/recipes/devshell/tempwork' does not contain a 'flake.nix', searching up
error: path '/home/amy/codeberg/nix-book' is not part of a flake (neither it nor its parent directories contain a 'flake.nix' file)</pre>
bash: line 30: cowsay: command not found
bash: line 31: ../../../../start-shell: No such file or directory</pre>
</div>
</div>
</div>
@ -4339,7 +4337,47 @@ error: path '/home/amy/codeberg/nix-book' is not part of a flake (neither it nor
<div class="listingblock">
<div class="title">flake.nix</div>
<div class="content">
<pre class="pygments highlight nowrap"><code data-lang="nix"><div class="lineno"><table class="linenotable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span>cat<span class="tok-p">:</span> flake<span class="tok-o">.</span>nix<span class="tok-p">:</span> No such file <span class="tok-ow">or</span> directory
<pre class="pygments highlight nowrap"><code data-lang="nix"><div class="lineno"><table class="linenotable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
<span class="normal"> 2</span>
<span class="normal"> 3</span>
<span class="normal"> 4</span>
<span class="normal"> 5</span>
<span class="normal"> 6</span>
<span class="normal"> 7</span>
<span class="normal"> 8</span>
<span class="normal"> 9</span>
<span class="normal">10</span>
<span class="normal">11</span>
<span class="normal">12</span>
<span class="normal">13</span>
<span class="normal">14</span>
<span class="normal">15</span>
<span class="normal">16</span>
<span class="normal">17</span>
<span class="normal">18</span>
<span class="normal">19</span>
<span class="normal">20</span>
<span class="normal">21</span></pre></div></td><td class="code"><div><pre><span></span><span class="tok-p">{</span>
<span class="tok-ss">inputs</span> <span class="tok-o">=</span> <span class="tok-p">{</span>
nixpkgs<span class="tok-o">.</span><span class="tok-ss">url</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;github:NixOS/nixpkgs&quot;</span><span class="tok-p">;</span>
flake-utils<span class="tok-o">.</span><span class="tok-ss">url</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;github:numtide/flake-utils&quot;</span><span class="tok-p">;</span>
hello-flake<span class="tok-o">.</span><span class="tok-ss">url</span> <span class="tok-o">=</span> <span class="tok-s2">&quot;git+https://codeberg.org/mhwombat/hello-flake&quot;</span><span class="tok-p">;</span>
<span class="tok-p">};</span>
<span class="tok-ss">outputs</span> <span class="tok-o">=</span> <span class="tok-p">{</span> self<span class="tok-p">,</span> nixpkgs<span class="tok-p">,</span> flake-utils<span class="tok-p">,</span> hello-flake <span class="tok-p">}:</span>
flake-utils<span class="tok-o">.</span>lib<span class="tok-o">.</span>eachDefaultSystem <span class="tok-p">(</span>system<span class="tok-p">:</span>
<span class="tok-k">let</span>
<span class="tok-ss">pkgs</span> <span class="tok-o">=</span> <span class="tok-nb">import</span> nixpkgs <span class="tok-p">{</span> <span class="tok-k">inherit</span> system<span class="tok-p">;</span> <span class="tok-p">};</span>
<span class="tok-k">in</span>
<span class="tok-p">{</span>
<span class="tok-ss">devShells</span> <span class="tok-o">=</span> <span class="tok-k">rec</span> <span class="tok-p">{</span>
<span class="tok-ss">default</span> <span class="tok-o">=</span> pkgs<span class="tok-o">.</span>mkShell <span class="tok-p">{</span>
<span class="tok-ss">buildInputs</span> <span class="tok-o">=</span> <span class="tok-p">[</span> hello-flake<span class="tok-o">.</span>packages<span class="tok-o">.</span><span class="tok-si">${</span>system<span class="tok-si">}</span><span class="tok-o">.</span>hello <span class="tok-p">];</span>
<span class="tok-p">};</span>
<span class="tok-p">};</span>
<span class="tok-p">}</span>
<span class="tok-p">);</span>
<span class="tok-p">}</span>
</pre></div></td></tr></table></div></code></pre>
</div>
</div>
@ -4348,29 +4386,17 @@ error: path '/home/amy/codeberg/nix-book' is not part of a flake (neither it nor
</div>
<div class="literalblock">
<div class="content">
<pre class="nowrap">$ cowsay "Moo!"
bash: line 62: cowsay: command not found
<pre class="nowrap">$ hello-flake
bash: line 24: hello-flake: command not found
$ nix develop
path '/home/amy/codeberg/nix-book/source/recipes/devshell/tempwork' does not contain a 'flake.nix', searching up
error: path '/home/amy/codeberg/nix-book' is not part of a flake (neither it nor its parent directories contain a 'flake.nix' file)</pre>
error: Path 'source/recipes/devshell' in the repository "/home/amy/codeberg/nix-book" is not tracked by Git.
To make it visible to Nix, run:
git -C "/home/amy/codeberg/nix-book" add "source/recipes/devshell"</pre>
</div>
</div>
<div class="paragraph">
<p>FINISH</p>
</div>
<div class="paragraph">
<p>FINISH</p>
</div>
<div class="paragraph">
<p>FINISH</p>
</div>
<div class="paragraph">
<p>FINISH</p>
</div>
<div class="paragraph">
<p>FINISH</p>
</div>
<div class="paragraph">
<p>You can use all of the flake reference styles defined in <a href="#flakeref">Section 10.1.2, &#8220;Flakes&#8221;</a>.</p>
</div>
</div>
@ -4942,7 +4968,7 @@ mkShell <span class="tok-p">{</span>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2025-09-04 17:04:48 IST
Last updated 2025-09-04 17:21:20 IST
</div>
</div>
</body>

View file

@ -0,0 +1,128 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"hello-flake": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1684524031,
"narHash": "sha256-0DYX7S7u5S2no2e6jiIv7cRfbpM5JBJq7+/1CUKEGxA=",
"ref": "refs/heads/main",
"rev": "099bfadc43f79a8929809bd097d12ef5de73ef62",
"revCount": 24,
"type": "git",
"url": "https://codeberg.org/mhwombat/hello-flake"
},
"original": {
"type": "git",
"url": "https://codeberg.org/mhwombat/hello-flake"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1681665000,
"narHash": "sha256-hDGTR59wC3qrQZFxVi2U3vTY+r02+Okbq080hO1C4Nk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3a6205d9f79fe526be03d8c465403b118ca4cf37",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1757000881,
"narHash": "sha256-Cl3ep4eX9Katb2m/DJLmbfltPSRaWnVAFtoI+VPVDLk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0987f8f26d7b889e23a7c533ae6d998b27924899",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"hello-flake": "hello-flake",
"nixpkgs": "nixpkgs_2"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -0,0 +1,21 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
hello-flake.url = "git+https://codeberg.org/mhwombat/hello-flake";
};
outputs = { self, nixpkgs, flake-utils, hello-flake }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells = rec {
default = pkgs.mkShell {
buildInputs = [ hello-flake.packages.${system}.hello ];
};
};
}
);
}