Commit Graph

71 Commits

Author SHA1 Message Date
Jared Baur
60a26bb3ae formats.xml: fix cross compilation
`python3.pkgs` does not splice, so with a package-set setup to
cross-compile, we end up building xmltodict for the host platform. By
using `python3Packages.xmltodict` instead, we only use xmltodict for the
build platform, which is all that is needed for generating XML documents
at build-time.

(cherry picked from commit ae98bf9246)
2025-07-29 11:59:12 +00:00
Martin Weinelt
c74fee9871 pkgs.formats.yaml_1_2: init
Same as YAML 1.1 but relies on the unpinned remarshal version which emits
YAML 1.2.

(cherry picked from commit eb8f7fcc12)
2025-06-20 15:01:28 +02:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
h7x4
d6041cc2ca pkgs-lib/hocon: fix type for _includes 2025-03-24 21:33:35 +01:00
Matt Sturgeon
2611d5bd70 formats.lua: init
Add a lua format, based on `lib.generators.toLua`.
2025-03-19 21:18:49 +00:00
InfinityGhost
07bcf3e909 pkgs-lib.formats.xml: Fix withHeader parameter 2025-03-04 13:01:11 -05:00
Silvan Mosberger
6c4b0e2858 pkgs-lib: Make tests independent of Nix file contents
Before, all of these tests would be rebuilt whenever formats.nix is
modified, but there's no need for this :)
2025-02-17 18:42:59 +01:00
Felix Buehler
a468405d67 pkgs-lib.formats.xml: init 2025-01-13 21:56:22 +01:00
uku
141f581d6f pkgs.formats: add cdn 2025-01-06 11:57:41 +01:00
piegames
591861f2b1 treewide: Fix invalid string escapes 2024-12-14 15:19:03 +01:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Alexander Braverman Masis
fe48be2ab5 formats.libconfig: add support for dashes 2024-11-27 10:15:21 -05:00
Wolfgang Walther
97c3fa4ebd hocon: remove deprecated indicators
This was scheduled for 24.11.
2024-11-23 19:37:39 +01:00
Silvan Mosberger
555f0e9f1e formats.ini: expose INI atom from all ini formats (#354800) 2024-11-18 16:11:51 +01:00
Johannes Kirschbauer
6b53949b0c formats.ini: expose INI atom from all ini formats 2024-11-18 16:07:22 +01:00
Martin Weinelt
80a4fc03f0 pkgs/lib/formats: test more explicitly for YAML 1.1 compat 2024-11-09 23:33:37 +01:00
Martin Weinelt
29fbef9adb pkgs.formats.yaml: create an alias for yaml_1_1
To keep assumptions about pkgs.formats.yaml in tact we pin it to a format
that will emit YAML 1.1.

Future usage should specify the YAML version explicitly.
2024-11-09 23:33:37 +01:00
Martin Weinelt
29dafe503f pkgs.formats.yaml: retain YAML 1.1 output 2024-11-09 23:33:35 +01:00
MithicSpirit
e14483d6a6 formats.ini: disable merging as list by default
Previously, setting listsAsDuplicateKeys or listToValue would make it so
merging these treat all values as lists, by coercing non-lists via
lib.singleton. Some programs (such as gamemode; see #345121), allow some
values to be repeated but not others, which can lead to unexpected
behavior when non-list values are merged like this rather than throwing
an error.

This now makes that behavior opt-in via the mergeAsList option. Setting
mergeAsList (to either true or false) without setting either
listsAsDuplicateKeys or listToValue is an error, since lists are
meaningless in this case.
2024-10-10 17:57:41 -04:00
Artturin
7a199f5dd6 nixos/doc: add documentation for formats.hocon and formats.libconfig (#320339) 2024-09-10 18:26:10 +03:00
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
h7x4
bf2adb82b7 nixos/doc: move implementation notes for formats.libconfig to docs 2024-06-16 20:58:50 +02:00
h7x4
141a8a6c86 nixos/doc: move implementation notes for formats.hocon to docs 2024-06-16 20:58:48 +02: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