Skip to content

Commit

Permalink
add to example
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Jan 13, 2024
1 parent 39227d5 commit b0f5423
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/build-helpers/trivial-build-helpers.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ Each of these functions will cause a derivation to be produced. When you coerce
Some of these functions will put the resulting files within a directory inside the derivation output. If you need to refer to the resulting files somewhere else in Nix code, remember to append the path to the file For example:

```nix
# if the derivation destination is a directory....
my-file = writeTextFile {
name = "my-file";
text = ''
Expand All @@ -80,6 +83,9 @@ my-file = writeTextFile {
destination = "/share/my-file";
}
# remember to tack on "/share/my-file" to the derivation path when
# using it elsewhere.
writeShellScript "evaluate-my-file.sh" ''
cat ${my-file}/share/my-file
'';
Expand Down

0 comments on commit b0f5423

Please sign in to comment.