$ hello-flake # Fails; dependency not available
-bash: line 40: hello-flake: command not found
+bash: line 31: hello-flake: command not found
$ nix develop
$ hello-flake # Works in development environment
Hello from your flake!
@@ -5197,8 +5207,7 @@ hello-flake
43
44
45
-
46
-
47 {
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
@@ -5232,7 +5241,6 @@ hello-flake
sed "s_hello-flake_"$HELLO"_" --in-place $out/bin/hello-again
'';
-
buildInputs = [ hello-flake.packages.${system}.hello ];
};
default = hello;
@@ -5251,7 +5259,7 @@ hello-flake
Line 5 adds hello-flake as an input to this flake,
Line 8 allows the output function to reference hello-flake.
-As expected, we need to add hello-flake as a build input, which we do in line 36.
+As expected, we need to add hello-flake as a build input, which we do in line 35.
That does make it available at build and runtime, but it doesn’t put it on the path,
so our hello-again script won’t be able to find it.
@@ -5284,6 +5292,9 @@ In that case, adding the dependency to buildInputs is sufficient.
$ nix run
+this derivation will be built:
+ /nix/store/aymycx9z7b8qgi0avs73b8c5xc4jxwx3-hello-again.drv
+building '/nix/store/aymycx9z7b8qgi0avs73b8c5xc4jxwx3-hello-again.drv'...
I'm a flake, and I'm running a command defined in a another flake.
Hello from your flake!
@@ -5608,7 +5619,7 @@ Hello from your flake!
|