Skip to content

Commit

Permalink
2024-07-31/01: add note about lib.escapeShellArg
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Jul 31, 2024
1 parent c7b66c6 commit 496fb2c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 2024-07-31/01-generating-yaml-files-with-nix.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ convertion between serialisation formats. `-jy` flag means "JSON to YAML". The
reason I choose `yj` is mostly because it is a single binary Go program, but
you can use whatever you prefer.

Note, I am using `lib.escapeShellArg` here to escape shell arguments, but it
may be safer to save to a file first (with e.g.: `pkgs.writeText`) and load the
contents from file instead. But I never had issues with the approch above.

By the way, there is a
[`lib.generators.toYAML`](https://github.com/NixOS/nixpkgs/blob/9f918d616c5321ad374ae6cb5ea89c9e04bf3e58/lib/generators.nix#L805)
inside `nixpkgs.lib`, but as of 2024-07-31 it only calls `lib.strings.toJSON`
Expand Down

0 comments on commit 496fb2c

Please sign in to comment.