Commit Graph

49 Commits

Author SHA1 Message Date
Philip Taron
1f6ce17b6d
formats: remove with statements 2024-08-18 06:31:18 -07:00
Sigmanificient
6dd44107ac treewide: remove unused lib (and other) arguments 2024-07-26 11:18:09 +02:00
éclairevoyant
2d71c78890
formats.hocon: fix typo 2024-07-23 12:07:07 -04:00
nicoo
6475c4c4b0 formats.javaProperties: Don't set !allowSubstitutes in generate builder 2024-05-25 17:30:40 +00:00
nicoo
3fa359407e formats: Set preferLocalBuild in generate builders
Otherwise, remote builds are used for trivial format conversions.
2024-05-25 17:27:40 +00:00
Sigmanificient
a2353716f6 treewide: remove unused occurence of fetchurl argument 2024-05-20 05:20:23 +02:00
Pol Dellaiera
2ca9ba37bc
Merge pull request #311299 from thenhnn/filesender-packaging-php-format
pkgs/formats: add generator for PHP config files
2024-05-16 16:45:26 +02:00
nhnn
083f211783
pkgs: add PHP to formats.nix 2024-05-16 13:07:34 +03:00
Philip Taron
25f91c20b6
formats.hocon: fix typo: compatability to compatibility 2024-04-02 14:49:46 -07:00
benaryorg
8b2d86b982
pkgs.formats: toINIWithGlobalSection wrapper
The new format is based on the existing wrapper and generates an INI file with an unnamed global section at the top as is used by *stunnel* for instance.
Technically the INI format is a subset of this however testing, type checking, and API guarantees profit from two separate generators.

Co-authored-by: tim-tx <tim-tx@users.noreply.github.com>
Signed-off-by: benaryorg <binary@benary.org>
2024-02-12 17:58:48 +00:00
benaryorg
3e72e7c014
pkgs.formats: negative type checking tests
Tests using `shouldFail` (new) enable testing for whether the type system catches any unintended uses (missing parameters or unavailable data types in the format).
It should not be necessary to test for all possible outliers for each format, however format-specific tests (for instance those using a rigid submodule structure) can ensure that common mistakes err out instead of being silently discarded, while also allowing test-driven development of sorts.

Signed-off-by: benaryorg <binary@benary.org>
2024-02-12 16:56:09 +00:00
h7x4
0e65eca7c6
formats.hocon: add backwards compatibility 2024-02-09 18:49:04 +01:00
h7x4
b6cdfec16c
formats.hocon: add tests 2024-02-09 16:40:22 +01:00
h7x4
2554eba2ca
formats.hocon: init 2024-02-09 16:40:22 +01:00
Minijackson
ad586e6beb formats.systemd: init INI-style systemd config file format 2023-12-09 01:50:23 +01:00
ckie
faf4e7b2dc
formats.libconfig: fix unstable store path dependency in test
Previously, this test would verify a writeText file with a constant
content is at a precise store path, but this is not actually the case
and the store path has changed maybe twice since the original
"pkgs.formats: Add libconfig format generator" PR was started, the
latest time being after it was merged.

We now placehold the store path in expected.txt and substitute it just
before we run the diff, alleviating the problem.
2023-10-31 16:50:54 +02:00
ckie
5707d01df2
pkgs-lib.formats: add note about missing pkgs quirk 2023-10-27 18:32:23 +02:00
h7x4
18ca8b21e2
formats.libconfig: add tests
Co-authored-by: ckie <25263210+ckiee@users.noreply.github.com>
Signed-off-by: h7x4 <h7x4@nani.wtf>
2023-10-27 18:32:22 +02:00
h7x4
3530342dcc
formats.libconfig: init
Co-authored-by: ckie <25263210+ckiee@users.noreply.github.com>
Signed-off-by: h7x4 <h7x4@nani.wtf>
2023-10-27 18:32:22 +02:00
K900
0782b000d9 pkgs-lib/tests/formats: fix expected output 2023-08-27 14:41:28 +03:00
Minijackson
2cb6dc90ac formats.pythonVars: init 2023-04-04 11:45:29 +02:00
Aaron Andersen
1cab362206
Merge pull request #178365 from fgaz/lib.formats.keyValue
lib.formats.keyValue: init
2022-07-01 00:11:34 +02:00
Francesco Gazzetta
0d2842a435 formats.keyValue: add tests 2022-06-20 22:36:29 +02:00
Ben Wolsieffer
14b01120c1 pkgs-lib: fix JSON, YAML and TOML cross-compilation
Splicing of nativeBuildInputs doesn't work unless callPackage is used, so
the generators were attempting to use host platform tools at build time.
2022-06-19 22:50:01 -04:00
Francesco Gazzetta
3ff9245301 lib.formats.keyValue: init 2022-06-18 21:11:14 +02:00
Sandro Jäckel
43d4ddf28e
treewide: remove usage of runCommandNoCC aliases 2022-06-07 16:57:06 +02:00
Silvan Mosberger
fd50826952
Merge pull request #104457 from ju1m/public-inbox
Update public-inbox to 1.8.0 and add systemd services
2022-05-12 20:46:39 +02:00
Julien Moutinho
8514800c42 nixos/public-inbox: init 2022-05-12 01:56:15 +02:00
Robert Hensing
3c10819ecf
Merge pull request #167172 from hercules-ci/javaProperties-type-coercions
`formats.javaProperties`: add type coercions
2022-04-25 16:29:48 +02:00
zowoq
9233d33579 pkgs-lib.formats: fix tomlkit output 2022-04-18 17:14:55 +10:00
lassulus
d23b044959 tests formats: fix due to tomlkit output change 2022-04-10 09:06:11 -04:00
Robert Hensing
62d781f09b tests.pkgs-lib: Fix for darwin 2022-04-04 14:41:40 +02:00
Robert Hensing
337c72b5cd pkgs.formats.javaProperties: Add type coercions
A usability improvement.
2022-04-04 14:24:15 +02:00
Robert Hensing
46156529f2 tests.pkgs-lib.formats: Allow strings with context in test runner 2022-04-04 14:22:22 +02:00
Robert Hensing
dcca8f5be2 tests.pkgs-lib.formats: Detect when impossible input is fed 2022-04-04 13:17:11 +02:00
Robert Hensing
ef6d9dfd71 pkgs.formats.javaProperties: Add implementation note to type 2022-04-04 13:11:00 +02:00
Robert Hensing
9a0739cbe2 formats.javaProperties: Add comment 2022-04-01 15:19:45 +02:00
Robert Hensing
4f8e44394c formats.javaProperties: init 2022-04-01 15:19:45 +02:00
Minijackson
6a96ddb675 pkgs-lib: Implement settings format for Elixir 2022-02-28 07:09:10 -05:00
Silvan Mosberger
c511b4e1f9 formats: Fix yaml test
Faulty test result was introduced in https://github.com/NixOS/nixpkgs/pull/133807
2021-08-26 01:57:43 +02:00
lucasew
83514ae7a9 lib.formats.yaml: use well known YAML format
The way `(lib.formats.yaml {}).generate` generates YAML is compliant
because on YAML 1.2 spec JSON is a subset of YAML but it bugs people's
minds and can lead to problems with software that is not compatible with
YAML 1.2.

This commit also changes the test of the generation function. Data
validation/typing remains the same.

See #133802.

Signed-off-by: lucasew <lucas59356@gmail.com>
2021-08-25 14:02:59 +02:00
Robert Hensing
fbafeb7ad5 treewide: runCommandNoCC -> runCommand
This has been synonymous for ~5y.
2021-08-15 17:36:41 +02:00
Ben Wolsieffer
98336c223b pkgs-lib: allow paths in TOML, YAML and JSON
Paths get automatically added to the store. The INI generator currently chokes
on paths, so it is not supported for now.
2021-06-28 11:59:03 -04:00
Silvan Mosberger
b8336c2b8a
formats.ini: Introduce listToValue argument (#121613)
Allows coercing lists to values. E.g.

  formats.ini { listToValue = lib.concatMapStringsSep ", " (lib.generators.mkValueStringDefault {}); }
2021-05-04 09:49:25 +02:00
Vladimír Čunát
a76152ac6e
pkgs-lib/tests/formats: improve message on failure
Foremost, the message was discarding double quotes on one side of the
diff, which was super-confusing to me, as I thought that the format
convertor broke that when in fact only whitespace was changed.

I thought I'd cat the files, but then... switching to `diff -u` seemed
self-sufficient.  It felt sufficiently non-controversial to push
directly, but certainly feel free to improve further.
2020-10-19 21:46:08 +02:00
Vladimír Čunát
92c96b7995
pkgs-lib/tests/formats: fix whitespace after PR #100372
Naturally, TOML doesn't define the exact shape of everything.
nix build -f pkgs/top-level/release.nix pkgs-lib-tests
2020-10-19 21:19:37 +02:00
Silvan Mosberger
9c1565a042
pkgs-lib: Add tests for formats 2020-07-29 18:08:25 +02:00
Silvan Mosberger
b6c540a87c
pkgs-lib: Implement settings formats for JSON, INI, YAML and TOML 2020-07-29 18:08:23 +02:00
Silvan Mosberger
888c923880
pkgs: Add pkgs-lib structure 2020-07-29 18:08:20 +02:00