Commit Graph

151 Commits

Author SHA1 Message Date
Peder Bergebakken Sundt
e1b62608ae formats: use AST-based approach for codegen (#549114) 2026-08-12 19:02:33 +00:00
h7x4
312a2fb08d pkgs-lib/hocon: use structuredAttrs instead of passAsFile (#530354) 2026-08-11 11:50:06 +00:00
h7x4
18bcb2238b formats: use AST-based approach for codegen 2026-08-04 20:24:50 +09:00
Robert Schütz
34ab5d3a78 formats.yaml_1_1: use remarshal v2 2026-07-30 09:55:06 -07:00
h7x4
9aa527f9fe formats.libconfig: use structuredAttrs instead of passAsFile (#530357) 2026-07-28 14:06:07 +00:00
h7x4
d5bf3451a7 formats.javaProperties: use structuredAttrs instead of passAsFile (#530355) 2026-07-22 17:57:14 +00:00
Stefan Frijters
10561f335e java-properties: move env variable into env for structuredAttrs (#524094) 2026-07-06 15:28:53 +00:00
nixpkgs-ci[bot]
b3d68622a1 Merge master into staging-nixos 2026-06-24 00:41:40 +00:00
Yuriy Taraday
efdeeebcb9 Reapply "pkgs-lib/formats: Use .attrs.json where possible"
This expands on https://github.com/NixOS/nixpkgs/pull/498928 that
introduced __structuredAttrs here by actually using data in
`.attrs.json` when it makes sense, instead of relying on environment
variables.

This reverts commit bf6ada5d78.
This reapplies commit 691dc02df0.
2026-06-23 22:01:42 +02:00
Yuriy Taraday
7601f8a108 pkgs-lib/formats: Add tests for serializing null values
In the effort to pass values directly as structured values, we ran into
issue with serializing null's.
This adds tests for null for all formats that support it and negative
tests for some others.

See https://github.com/NixOS/nixpkgs/pull/524404#issuecomment-4665694636
2026-06-23 19:00:26 +02:00
Yuriy Taraday
f995f8cca8 Reapply "pkgs-lib/formats: Use .attrs.json directly for TOML"
This reverts commit 36709df191.
2026-06-23 18:26:12 +02:00
Yt
25e5e0a252 pkgs.formats.elixirConf: Allow for Elixir charlists (#532327) 2026-06-19 01:41:25 +00:00
Pol Dellaiera
29c66c6eaa pkgs.formats.configobj: init
Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
2026-06-16 20:58:27 +02:00
Kerstin Humm
4e14aa4aa4 pkgs.formats.elixirConf: Allow for Elixir charlists
These are needed for defining strings that reach through to Erlang code
2026-06-16 15:38:43 +02:00
isabel
a428fc7bf4 pkgs.formats: performance cleanups (#529122) 2026-06-10 20:26:41 +00:00
Stefan Frijters
3cb8b0787d formats.javaProperties: use structuredAttrs instead of passAsFile in test 2026-06-10 15:34:37 +02:00
Stefan Frijters
ed9cec9d25 formats.libconfig: use structuredAttrs instead of passAsFile
Also use finalAttrs pattern instead of rec.

Tested via `nix-build -A tests.pkgs-lib.libconfig`
2026-06-10 15:21:40 +02:00
Stefan Frijters
dfde99fd70 formats.javaProperties: use structuredAttrs instead of passAsFile
Tested via `nix-build -A tests.pkgs-lib.java-properties`
2026-06-10 15:19:48 +02:00
Stefan Frijters
5cb5028d2d pkgs-lib/hocon: use structuredAttrs instead of passAsFile
Also use finalAttrs pattern.

Tested via `nix-build -A tests.pkgs-lib.hocon`
2026-06-10 15:16:34 +02:00
Matt Sturgeon
36709df191 Revert "pkgs-lib/formats: Use .attrs.json directly for TOML" 2026-06-10 13:30:28 +01:00
K900
bf6ada5d78 Revert "pkgs-lib/formats: Use .attrs.json where possible" 2026-06-10 09:28:51 +03:00
Eman Resu
623c813d5f pkgs.formats: move toJSON to global scope 2026-06-07 08:49:02 -04:00
Eman Resu
f214820f08 pkgs.formats.nixConf: use package from lib.types explicitly
This was actually being set to the package attribute for the function,
which is definitely not what we want.
2026-06-07 08:48:20 -04:00
Eman Resu
d6c42b7725 pkgs.formats: use lib functions from global scope 2026-06-07 08:48:20 -04:00
Eman Resu
6bd71d7e08 pkgs.formats.hcl1: host let variables to outside function scope 2026-06-07 08:48:18 -04:00
Eman Resu
01d76243e0 pkgs.formats.nixConf: host let variables outside of function scope 2026-06-07 08:48:10 -04:00
Eman Resu
5e0e1a165a pkgs.formats.elixirConf: host variables to outside function 2026-06-07 08:48:09 -04:00
Eman Resu
a13dd134c1 pkgs.formats.elixirConf: hoist let variables above args 2026-06-07 08:48:09 -04:00
Eman Resu
02c3f8ed7b pkgs.formats.keyValue: do more logic before generation
Allows more caching if the same generator is called multiple times.
2026-06-07 08:48:09 -04:00
Eman Resu
bffa9f19fb pkgs.formats.cdn: remove no-op merge
The json format only contains `type` and `generate` attributes, so
merging replaces both of them.
2026-06-07 08:48:09 -04:00
Eman Resu
e7ba7a958b pkgs.formats.toml: remove unused callPackage arg 2026-06-07 08:48:08 -04:00
Eman Resu
4cf86ef3bf pkgs.formats.gitIni: remove unused variable 2026-06-07 08:48:08 -04:00
Eman Resu
8217bcabaf pkgs.formats.ini: add helper to coerce all lists more lazily
Before, we would run a mapAttrs on every attribute, checking listToValue
on each of them. But listToValue is known ahead of time. Instead, we can
only run that map if listToValue isn't null in the first place.
2026-06-07 08:48:08 -04:00
Eman Resu
3198ae073a pkgs.formats.ini: rename list coercion helper
It coerces lists, it doesn't turn other attributes into lists.
2026-06-07 08:48:08 -04:00
Eman Resu
cc2394d9fa pkgs.formats.ini: share ignoredArgs between ini generators 2026-06-07 08:48:08 -04:00
nixpkgs-ci[bot]
f3fe341d1f Merge master into staging-nixos 2026-06-06 00:45:45 +00:00
Yuriy Taraday
1cc9c0cf12 pkgs-lib/formats: Use .attrs.json directly for TOML
A spinoff from https://github.com/NixOS/nixpkgs/pull/524404.
Add `--unwrap` argument to json2x, just like json2yaml has.
2026-06-05 15:50:45 +02:00
Yuriy Taraday
691dc02df0 pkgs-lib/formats: Use .attrs.json where possible
This expands on https://github.com/NixOS/nixpkgs/pull/498928 that
introduced __structuredAttrs here by actually using data in
`.attrs.json` when it makes sense, instead of relying on environment
variables. This leads to less temporary files, faster execution and
nicer code.
2026-06-04 19:21:52 +02:00
zowoq
1859a1a77c pkgs-lib/formats: use buildPackages for json2x 2026-05-30 13:50:27 +10:00
figsoda
701d8bd46b pkgs-lib/formats: reimplement toml.generate with Rust 2026-05-28 12:07:54 -04:00
isabel
c06c7892c1 formats.toml: don't merge with json format (#523802) 2026-05-26 21:15:50 +00:00
zimbatm
edb4b053f5 pkgs.formats.javaProperties: use lib.sources.sourceByGlobs
Uses the cleaner expression
2026-05-26 21:49:00 +12:00
Sigmanificient
287994f163 java-properties: move env variable into env for structuredAttrs 2026-05-25 18:37:28 +02:00
Eman Resu
3740ca5732 formats.toml: don't merge with json format 2026-05-24 18:39:56 -04:00
André Lima
cf5266fbda pkgs-lib/formats: fix tests 2026-05-13 20:05:36 +01:00
K900
cd9a5eeafb Merge remote-tracking branch 'origin/staging-next' into staging 2026-05-04 21:37:41 +03:00
figsoda
331c7d8e30 pkgs-lib/formats: revert to remarshal for toml 2026-05-04 12:13:42 -04:00
K900
32048025b4 Merge remote-tracking branch 'origin/staging-next' into staging 2026-04-22 15:27:12 +03:00
phaer
e23ad3bd27 pkgs-lib/formats: switch toml generator from yj to go-toml (jsontoml)
Fixes NixOS/nixpkgs#511970, sclevine/yj#52.

Replace yj with go-toml's jsontoml for JSON-to-TOML conversion.
Update tomlAtoms expected output for go-toml's literal-string style.
2026-04-22 12:17:40 +02:00
phaer
32c7a5e046 pkgs-lib/formats: add regression tests for toml generator
Add two shouldPass tests that catch known yj regressions:

- tomlHeterogeneousArray: arrays mixing scalars and attrsets crash yj
  with 'unexpected primitive type' (NixOS/nixpkgs#511970)

- tomlCommaInKey: keys containing commas are silently truncated
  because yj stores TOML keys in Go struct tags where commas are
  option separators (sclevine/yj#52)

Expected values are taken from go-toml's jsontoml output.
Both tests fail under the current yj backend.
2026-04-22 12:17:33 +02:00