summaryrefslogtreecommitdiffstats
path: root/pkgs/pkgs-lib
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-04-04 13:11:00 +0200
committerRobert Hensing <robert@roberthensing.nl>2022-04-04 13:11:00 +0200
commitef6d9dfd710cf082b90aa78804f0743aa9b1a8a8 (patch)
tree0682b8d5d34ccfb339affd6b3f1d6f4049a99170 /pkgs/pkgs-lib
parent83bf24b066709c492a93eb2ae07979ac0af17165 (diff)
pkgs.formats.javaProperties: Add implementation note to type
Diffstat (limited to 'pkgs/pkgs-lib')
-rw-r--r--pkgs/pkgs-lib/formats/java-properties/default.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/pkgs/pkgs-lib/formats/java-properties/default.nix b/pkgs/pkgs-lib/formats/java-properties/default.nix
index b63b96d32769..6ac56bff4bf6 100644
--- a/pkgs/pkgs-lib/formats/java-properties/default.nix
+++ b/pkgs/pkgs-lib/formats/java-properties/default.nix
@@ -1,6 +1,30 @@
{ lib, pkgs }:
{
javaProperties = { comment ? "Generated with Nix" }: {
+
+ # Design note:
+ # A nested representation of inevitably leads to bad UX:
+ # 1. keys like "a.b" must be disallowed, or
+ # the addition of options in a freeformType module
+ # become breaking changes
+ # 2. adding a value for "a" after "a"."b" was already
+ # defined leads to a somewhat hard to understand
+ # Nix error, because that's not something you can
+ # do with attrset syntax. Workaround: "a"."", but
+ # that's too little too late. Another workaround:
+ # mkMerge [ { a = ...; } { a.b = ...; } ].
+ #
+ # Choosing a non-nested representation does mean that
+ # we sacrifice the ability to override at the (conceptual)
+ # hierarchical levels, _if_ an application exhibits those.
+ #
+ # Some apps just use periods instead of spaces in an odd
+ # mix of attempted categorization and natural language,
+ # with no meaningful hierarchy.
+ #
+ # We _can_ choose to support hierarchical config files
+ # via nested attrsets, but the module author should
+ # make sure that problem (2) does not occur.
type = lib.types.attrsOf lib.types.str;
generate = name: value: