Commit graph

99 commits

Author SHA1 Message Date
Arian van Putten
0099ab9117 pkgs-lib/formats: add hcl1 format 2026-02-27 11:37:45 +01:00
Dyego Aurélio
28096cc5e3 treewide: apply nixfmt 1.2.0 2026-01-22 18:37:56 -03:00
Johannes Kirschbauer
c988f82f7a
lib/types: add types.{json,toml} from pkgs.formats 2026-01-20 21:26:05 +01:00
Johannes Kirschbauer
cbcce89d8c
pkgs/formats: toml format type is not nullable 2025-12-18 13:56:23 +01:00
jopejoe1
6a11d4a70b tests.pkgs-lib: expose the tests included in it 2025-12-08 12:01:06 +01:00
uku
21e7ccb126
formats.javaProperties: fix cross-compilation 2025-12-06 17:54:57 +01:00
nixpkgs-ci[bot]
03e8920ce4
Merge master into staging-next 2025-10-17 18:05:18 +00:00
Sizhe Zhao
6f8bb63800
pkgs.formats.plist: don't test path
Reference: https://hydra.nixos.org/build/310233987/nixlog/1/tail
2025-10-17 21:40:19 +08:00
nixpkgs-ci[bot]
a9cd171877
Merge master into staging-next 2025-10-17 00:16:42 +00:00
Felix Bühler
6ef6063ef6
pkgs.formats.plist: init (#448839) 2025-10-16 19:28:50 +00:00
nixpkgs-ci[bot]
bff70f3185
Merge master into staging-next 2025-10-13 12:07:07 +00:00
Arian van Putten
d1493eb6df
pkgs-lib/formats/systemd: make format a function (#448460) 2025-10-13 11:16:24 +00:00
h7x4
fa6b7ec3d4
pkgs-lib/formats/systemd: make format a function 2025-10-13 20:11:40 +09:00
Sizhe Zhao
948a89c96b
pkgs.formats.plist: init 2025-10-06 00:53:31 +08:00
h7x4
f2636ab940
pkgs-lib.formats: add missing parameter comment for mkStructuredType 2025-10-05 23:28:56 +09:00
h7x4
8fd6252153
pkgs-lib.formats: move mkStructuredType to let-block 2025-10-05 23:28:51 +09:00
Felix Buehler
c5cdad7dd4 pkgs-lib.formats: add mkStructuredType 2025-10-05 11:47:35 +02:00
Wolfgang Walther
91a8fee3aa
treewide: remove redundant parentheses
Auto-fixed by nixf-diagnose.
2025-10-05 10:52:03 +02:00
h7x4
5ca4c89bd4
pkgs-lib/pythonVars: add test 2025-09-18 18:15:57 +02:00
h7x4
b37cd2921d
pkgs-lib/pythonVars: add support for imports and lib.mkRaw 2025-09-18 17:57:04 +02:00
cinereal
c30b9ec953
formats: add nixConf
adds `nixConf` (to generate `nix.conf` files) as a file format to
`lib.formats`, and uses it for serializing `nix.settings`.

this makes it easier to 'manually' serialize `nix.settings`, which is
relevant in e.g. safely handling sensitive values such as that of
`nix.settings.access-tokens`.

Signed-off-by: cinereal <cinereal@riseup.net>
2025-09-06 13:25:52 +02:00
h7x4
9670af4242
pkgs-lib/hocon: separate includes from the following fields (#420239) 2025-08-20 17:31:28 +03:00
name_snrl
935f232934
pkgs-lib/hocon: separate includes from the following fields 2025-08-20 16:19:00 +02:00
Jared Baur
ae98bf9246
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.
2025-07-28 10:35:10 -07:00
Vladimír Čunát
7186236235
formats tests: drop jdk8 and add default jdk
It was weird to keep testing an ancient version
but not test the default one.  Now jdk8 has issues:
https://hydra.nixos.org/build/301885710#tabs-buildsteps
2025-07-11 10:51:41 +02:00
Vladimír Čunát
26650e0d10
pkgs/pkgs-lib/tests/formats.nix: adapt to new style
https://hydra.nixos.org/build/300150957/nixlog/2/tail
Probably caused by f80b06e
2025-06-17 21:08:39 +02:00
Martin Weinelt
eb8f7fcc12
pkgs.formats.yaml_1_2: init
Same as YAML 1.1 but relies on the unpinned remarshal version which emits
YAML 1.2.
2025-06-11 17:39:36 +02:00
Philip Taron
a822df313f
formats: extract things needed from pkgs in the let binding
This is an attempt to solve the NixOS manual failures seen in https://github.com/NixOS/nixpkgs/pull/415662
2025-06-10 16:29:36 -07:00
Philip Taron
f13654fe8a
formats: extract things needed from lib in the let binding
It's more vertical space but it ought to be more performant.
2025-06-10 16:28:50 -07:00
Matt Sturgeon
feef690b05
formats: deprecate accidental lib.types aliases
Introduced in https://github.com/NixOS/nixpkgs/pull/335232
(commit 1f6ce17b6d)
2025-06-10 21:32:14 +01: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 https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.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