diff options
author | Robert Hensing <robert@roberthensing.nl> | 2022-03-28 09:23:25 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2022-04-01 15:19:45 +0200 |
commit | 9a0739cbe2b3b56dbc923a36f4e204afba917641 (patch) | |
tree | 5709a1466e206e0faddbe2844855c658d7cd77c3 /pkgs/pkgs-lib/formats/java-properties/default.nix | |
parent | 4f8e44394cb5afdef302618d3b2a75ad4291c71f (diff) | |
download | nixlib-9a0739cbe2b3b56dbc923a36f4e204afba917641.tar nixlib-9a0739cbe2b3b56dbc923a36f4e204afba917641.tar.gz nixlib-9a0739cbe2b3b56dbc923a36f4e204afba917641.tar.bz2 nixlib-9a0739cbe2b3b56dbc923a36f4e204afba917641.tar.lz nixlib-9a0739cbe2b3b56dbc923a36f4e204afba917641.tar.xz nixlib-9a0739cbe2b3b56dbc923a36f4e204afba917641.tar.zst nixlib-9a0739cbe2b3b56dbc923a36f4e204afba917641.zip |
formats.javaProperties: Add comment
Diffstat (limited to 'pkgs/pkgs-lib/formats/java-properties/default.nix')
-rw-r--r-- | pkgs/pkgs-lib/formats/java-properties/default.nix | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pkgs/pkgs-lib/formats/java-properties/default.nix b/pkgs/pkgs-lib/formats/java-properties/default.nix index e4f42a61f5c8..b63b96d32769 100644 --- a/pkgs/pkgs-lib/formats/java-properties/default.nix +++ b/pkgs/pkgs-lib/formats/java-properties/default.nix @@ -1,6 +1,6 @@ { lib, pkgs }: { - javaProperties = {}: { + javaProperties = { comment ? "Generated with Nix" }: { type = lib.types.attrsOf lib.types.str; generate = name: value: @@ -76,10 +76,15 @@ inputEncoding = "UTF-8"; + inherit comment; + } '' - jq -r --arg hash '#' "$jqCode" "$valuePath" \ - | iconv --from-code "$inputEncoding" --to-code JAVA \ - > "$out" + ( + echo "$comment" | while read -r ln; do echo "# $ln"; done + echo + jq -r --arg hash '#' "$jqCode" "$valuePath" \ + | iconv --from-code "$inputEncoding" --to-code JAVA \ + ) > "$out" ''; }; } |