mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2025-12-26 16:24:56 +08:00
expanded
This commit is contained in:
parent
fc5b0d86d7
commit
605cde03cd
3 changed files with 11 additions and 6 deletions
|
|
@ -41,9 +41,9 @@ Once we exit that shell, the `hello-flake` command is no longer
|
|||
directly available.
|
||||
|
||||
....
|
||||
$# echo '$ exit'
|
||||
$# echo '$ hello-flake'
|
||||
sh: line 3: hello-flake: command not found
|
||||
$# echo executable=$(which hello-flake) > temp.sh # save variable
|
||||
$ exit
|
||||
$ hello-flake # Won't work outside development shell
|
||||
....
|
||||
|
||||
However, we can still run the command using the store path we found
|
||||
|
|
@ -51,7 +51,8 @@ earlier. That's not particularly convenient, but it does demonstrate
|
|||
that the package remains in the store for future use.
|
||||
|
||||
....
|
||||
$# executable=$(which hello-flake)
|
||||
$# source temp.sh # restore variable
|
||||
$# rm temp.sh
|
||||
$# echo '$ '${executable}
|
||||
$# ${executable}
|
||||
....
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@ An attribute set that is used as a function parameter is often called an _argume
|
|||
To specify an attribute set as a function parameter, we use a _set pattern_,
|
||||
which has the form
|
||||
|
||||
{ _name1_, _name2_, ... }
|
||||
[source,subs=quotes]
|
||||
----
|
||||
{ _name1_, _name2_, ... }
|
||||
----
|
||||
|
||||
Note that while the key-value associations in attribute sets are separated by semi-colons,
|
||||
the key names in the attribute set _pattern are separated by commas.
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ a path
|
|||
....
|
||||
|
||||
If an expression can be interpreted as a path, Nix will do so.
|
||||
This is useful, because paths are _far_ more commonly used in Nix expressions that arithmetic operators.
|
||||
This is useful, because paths are _far_ more commonly used in Nix expressions
|
||||
than arithmetic operators.
|
||||
In this case, Nix interpreted `6/2` as a relative path from the current directory,
|
||||
which in the above example was `/home/amy/codeberg/nix-book`.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue