1
+2
+3
#!/usr/bin/env sh
+
+cowsay "Hello from your flake!"
+
+diff --git a/index.html b/index.html index 9f8fce0..c31f6f3 100644 --- a/index.html +++ b/index.html @@ -215,7 +215,8 @@
1
+2
+3
#!/usr/bin/env sh
+
+cowsay "Hello from your flake!"
+
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
{
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, flake-utils }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+ in
+ {
+ packages = rec {
+ hello = pkgs.stdenv.mkDerivation rec {
+ name = "hello-flake";
+
+ src = ./.;
+
+ unpackPhase = "true";
+
+ buildPhase = ":";
+
+ installPhase =
+ ''
+ mkdir -p $out/bin
+ cp $src/hello-flake $out/bin/hello-flake
+ chmod +x $out/bin/hello-flake
+ '';
+ };
+ default = hello;
+ };
+
+ apps = rec {
+ hello = flake-utils.lib.mkApp { drv = self.packages.${system}.hello; };
+ default = hello;
+ };
+ }
+ );
+}
+
+Unresolved directive in recipes/build/main.adoc - include::nixpkg/main-generated.adoc[leveloffset=+1]
+Here’s a demonstration using the flake.
+$ nix run +this derivation will be built: + /nix/store/k2w6258690zjhdf6y59vfpfiz7d67jb1-hello-flake.drv +building '/nix/store/k2w6258690zjhdf6y59vfpfiz7d67jb1-hello-flake.drv'... +error: builder for '/nix/store/k2w6258690zjhdf6y59vfpfiz7d67jb1-hello-flake.drv' failed with exit code 1; + last 8 log lines: + > Running phase: unpackPhase + > Running phase: patchPhase + > Running phase: updateAutotoolsGnuConfigScriptsPhase + > Running phase: configurePhase + > no configure script, doing nothing + > Running phase: buildPhase + > Running phase: installPhase + > cp: cannot stat '/nix/store/mhmgp4r3vihp0ar76ik7ah5q9djzhrdf-tempwork/hello-flake': No such file or directory + For full logs, run: + nix log /nix/store/k2w6258690zjhdf6y59vfpfiz7d67jb1-hello-flake.drv+
Unresolved directive in recipes/build/main.adoc - include::flake/main-generated.adoc[leveloffset=+1]
@@ -4893,8 +5010,9 @@ Line 15 should be replaced with:Unresolved directive in recipes/build/main.adoc - include::env-var/main-generated.adoc[leveloffset=+1]
In this example, we will use a nix package (not a flake) defined in a remote git repo. However, you can use any of the flake reference styles defined in Section 10.1.2, “Flakes”.
@@ -5048,6 +5166,7 @@ by specifying the full path tohello-nix.
$ hello-nix # this will fail bash: line 40: hello-nix: command not found $ nix develop +building '/nix/store/0qzgar07id1cpygx9yyxfsvls1w2jf0c-hello-again-env.drv'... $ hello-nix Hello from your nix package!