From f266726f4d73131bf21b217ca57652bd4bb17b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amy=20de=20Buitl=C3=A9ir?= Date: Mon, 15 Sep 2025 15:11:31 +0100 Subject: [PATCH] temp --- index.html | 116 +----------------- source/recipes/build/main.adoc | 4 +- source/recipes/build/nix-non-flake/main.adoc0 | 2 +- .../nix-non-flake/tempwork/flake.lock | 0 .../tempwork}/flake.nix | 10 -- .../build/nix-non-flake/tempwork/hello-again | 4 + source/recipes/build/nixpkg/flake.nix | 45 ------- source/recipes/build/nixpkg/hello-with-cow | 3 - source/recipes/build/nixpkg/main.adoc0 | 34 ----- source/recipes/devshell/main.adoc | 2 - .../devshell/nix-non-flake/tempwork/flake.nix | 27 ---- 11 files changed, 9 insertions(+), 238 deletions(-) rename source/recipes/{devshell => build}/nix-non-flake/tempwork/flake.lock (100%) rename source/recipes/build/{non-flake => nix-non-flake/tempwork}/flake.nix (81%) create mode 100755 source/recipes/build/nix-non-flake/tempwork/hello-again delete mode 100644 source/recipes/build/nixpkg/flake.nix delete mode 100644 source/recipes/build/nixpkg/hello-with-cow delete mode 100644 source/recipes/build/nixpkg/main.adoc0 delete mode 100644 source/recipes/devshell/nix-non-flake/tempwork/flake.nix diff --git a/index.html b/index.html index ee3c1ec..0fea732 100644 --- a/index.html +++ b/index.html @@ -5100,7 +5100,7 @@ Hello from your nix package!
If the nix derivation requires nixpkgs

In this case, we need to write the derivation ourselves. -We can use default.nix as a model. +We can use default.nix (from the hello-nix repo) as a model. Line 15 should be replaced with:

@@ -5117,9 +5117,6 @@ Line 15 should be replaced with:

};
-
-

Unresolved directive in recipes/devshell/main.adoc - include::non-flake/main-generated.adoc[leveloffset=+1]

-
@@ -5127,115 +5124,8 @@ Line 15 should be replaced with:

10.5. Build/runtime environments

10.5.1. Access a top level package from the Nixpkgs/NixOS repo

-
-
hello-with-cow
-
-
1
-2
-3
#!/usr/bin/env sh
-
-cowsay "Hello from your flake!"
-
-
-
-
-
flake.nix
-
-
 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
-40
-41
{
-  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-with-cow";
-
-            src = ./.;
-
-            unpackPhase = "true";
-
-            buildPhase = ":";
-
-            installPhase =
-              ''
-                mkdir -p $out/bin
-                cp $src/hello-with-cow $out/bin
-                chmod +x $out/bin/hello-with-cow
-              '';
-
-            buildInputs = [ pkgs.cowsay ];
-          };
-          default = hello;
-        };
-
-        apps = rec {
-          hello = flake-utils.lib.mkApp { drv = self.packages.${system}.hello; };
-          default = hello;
-        };
-      }
-    );
-}
-
-
-
-

Here’s a demonstration using the flake.

-
-
-
-
$ nix run
-this derivation will be built:
-  /nix/store/rlg4ym95l3jh9mv2mc1yd6qf0i2px844-hello-with-cow.drv
-building '/nix/store/rlg4ym95l3jh9mv2mc1yd6qf0i2px844-hello-with-cow.drv'...
-/nix/store/ps5mk6rvk7917f6ls58hz0ifs3580mq0-hello-with-cow/bin/hello-with-cow: line 3: cowsay: command not found
-
+

See Section 8.2, “Introducing a dependency”.

Unresolved directive in recipes/build/main.adoc - include::flake/main-generated.adoc[leveloffset=+1]

@@ -5474,7 +5364,7 @@ Hello from your flake!
diff --git a/source/recipes/build/main.adoc b/source/recipes/build/main.adoc index f7508bd..8907f74 100644 --- a/source/recipes/build/main.adoc +++ b/source/recipes/build/main.adoc @@ -1,6 +1,6 @@ = Build/runtime environments -include::nixpkg/main-generated.adoc[leveloffset=+1] +include::nixpkg/main.adoc[leveloffset=+1] include::flake/main-generated.adoc[leveloffset=+1] @@ -11,5 +11,3 @@ include::haskell-flake/main-generated.adoc[leveloffset=+1] include::env-var/main-generated.adoc[leveloffset=+1] include::nix-non-flake/main-generated.adoc[leveloffset=+1] - -include::non-flake/main-generated.adoc[leveloffset=+1] diff --git a/source/recipes/build/nix-non-flake/main.adoc0 b/source/recipes/build/nix-non-flake/main.adoc0 index 6367263..7d22777 100644 --- a/source/recipes/build/nix-non-flake/main.adoc0 +++ b/source/recipes/build/nix-non-flake/main.adoc0 @@ -24,7 +24,7 @@ All it does is invoke `hello-nix`, which is the input we added <<#devshell-nix-n $# cat hello-again .... -[source,nix,linenums,highlight='31..33,36'] +[source,nix,linenums,highlight='5..8,17,36..38,42'] .flake.nix .... $# cat flake.nix diff --git a/source/recipes/devshell/nix-non-flake/tempwork/flake.lock b/source/recipes/build/nix-non-flake/tempwork/flake.lock similarity index 100% rename from source/recipes/devshell/nix-non-flake/tempwork/flake.lock rename to source/recipes/build/nix-non-flake/tempwork/flake.lock diff --git a/source/recipes/build/non-flake/flake.nix b/source/recipes/build/nix-non-flake/tempwork/flake.nix similarity index 81% rename from source/recipes/build/non-flake/flake.nix rename to source/recipes/build/nix-non-flake/tempwork/flake.nix index 7963ede..53107d1 100644 --- a/source/recipes/build/non-flake/flake.nix +++ b/source/recipes/build/nix-non-flake/tempwork/flake.nix @@ -15,16 +15,6 @@ inherit system; }; helloNix = import hello-nix { inherit pkgs; }; -# helloNix = pkgs.stdenv.mkDerivation { -# name = "hello-nix"; -# src = hello-nix; -# installPhase = -# '' -# mkdir -p $out/bin -# cp $src/hello-nix $out/bin/hello-nix -# chmod +x $out/bin/hello-nix -# ''; -# }; in { packages = rec { diff --git a/source/recipes/build/nix-non-flake/tempwork/hello-again b/source/recipes/build/nix-non-flake/tempwork/hello-again new file mode 100755 index 0000000..5315da4 --- /dev/null +++ b/source/recipes/build/nix-non-flake/tempwork/hello-again @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +echo "I'm a flake, but I'm running a command defined in a non-flake package." +hello-nix diff --git a/source/recipes/build/nixpkg/flake.nix b/source/recipes/build/nixpkg/flake.nix deleted file mode 100644 index 69eaca3..0000000 --- a/source/recipes/build/nixpkg/flake.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - 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-with-cow"; - - src = ./.; - - unpackPhase = "true"; - - buildPhase = ":"; - - installPhase = - '' - mkdir -p $out/bin - cp $src/hello-with-cow $out/bin - chmod +x $out/bin/hello-with-cow - - # modify the hello-again script so it can find hello-nix - COWSAY=$(type -p cowsay) - sed "s_cowsay_"$COWSAY"_" --in-place $out/bin/hello-with-cow - ''; - - buildInputs = [ pkgs.cowsay ]; - }; - default = hello; - }; - - apps = rec { - hello = flake-utils.lib.mkApp { drv = self.packages.${system}.hello; }; - default = hello; - }; - } - ); -} diff --git a/source/recipes/build/nixpkg/hello-with-cow b/source/recipes/build/nixpkg/hello-with-cow deleted file mode 100644 index 23690a6..0000000 --- a/source/recipes/build/nixpkg/hello-with-cow +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -cowsay "Moo!" diff --git a/source/recipes/build/nixpkg/main.adoc0 b/source/recipes/build/nixpkg/main.adoc0 deleted file mode 100644 index ec06a9c..0000000 --- a/source/recipes/build/nixpkg/main.adoc0 +++ /dev/null @@ -1,34 +0,0 @@ -= Access a top level package from the Nixpkgs/NixOS repo - -//// -$ mkdir tempwork -$ cd tempwork -$ cp ../hello-with-cow ../flake.nix . -$ git add hello-with-cow flake.nix -$ nix develop -$ git add flake.lock -$ git commit -a -m temp -//// - -[source,shell,linenums] -.hello-with-cow -.... -$# cat hello-with-cow -.... - -[source,nix,linenums,highlight=15] -.flake.nix -.... -$# cat flake.nix -.... - -Here's a demonstration using the flake. - -.... -$ nix run -.... - -//// -Good adoc0 scripts clean up after themselves. -$ cd .. ; rm -rf tempwork # clean up -//// diff --git a/source/recipes/devshell/main.adoc b/source/recipes/devshell/main.adoc index addb3d5..5b5bb4b 100644 --- a/source/recipes/devshell/main.adoc +++ b/source/recipes/devshell/main.adoc @@ -11,5 +11,3 @@ include::haskell-pkg/main-generated.adoc[leveloffset=+1] include::env-var/main-generated.adoc[leveloffset=+1] include::nix-non-flake/main-generated.adoc[leveloffset=+1] - -include::non-flake/main-generated.adoc[leveloffset=+1] diff --git a/source/recipes/devshell/nix-non-flake/tempwork/flake.nix b/source/recipes/devshell/nix-non-flake/tempwork/flake.nix deleted file mode 100644 index b4b97a6..0000000 --- a/source/recipes/devshell/nix-non-flake/tempwork/flake.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs"; - flake-utils.url = "github:numtide/flake-utils"; - hello-nix = { - url = "git+https://codeberg.org/mhwombat/hello-nix"; - flake = false; - }; - }; - - outputs = { self, nixpkgs, flake-utils, hello-nix }: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { - inherit system; - }; - helloNix = import hello-nix { inherit pkgs; }; - in - { - devShells = rec { - default = pkgs.mkShell { - packages = [ helloNix ]; - }; - }; - } - ); -}