formats.yaml_1_1: use remarshal v2 (#547212)
This commit is contained in:
@@ -10,17 +10,17 @@ let
|
||||
configFile = pkgs.callPackage (
|
||||
{
|
||||
runCommandLocal,
|
||||
remarshal_0_17,
|
||||
remarshal,
|
||||
stdenv,
|
||||
}:
|
||||
runCommandLocal "knot-resolver.yaml"
|
||||
{
|
||||
nativeBuildInputs = [ remarshal_0_17 ];
|
||||
nativeBuildInputs = [ remarshal ];
|
||||
value = builtins.toJSON cfg.settings;
|
||||
passAsFile = [ "value" ];
|
||||
}
|
||||
''
|
||||
json2yaml "$valuePath" "$out"
|
||||
remarshal --from json --to yaml-1.1 "$valuePath" "$out"
|
||||
${
|
||||
# We skip validation if the build platform cannot execute # the binary targeting the host platform.
|
||||
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
|
||||
@@ -18,7 +18,7 @@ let
|
||||
];
|
||||
};
|
||||
|
||||
customSettingsYaml = (pkgs.formats.yaml_1_1 { }).generate "custom-conf.yaml" customSettings;
|
||||
customSettingsYaml = (pkgs.formats.yaml_1_2 { }).generate "custom-conf.yaml" customSettings;
|
||||
in
|
||||
{
|
||||
name = "dashy";
|
||||
|
||||
@@ -477,7 +477,11 @@ recurseIntoAttrs {
|
||||
|
||||
yaml = expectDataEqual {
|
||||
file = writeYAML "data.yaml" { hello = "world"; };
|
||||
expected = "hello: world\n";
|
||||
expected = ''
|
||||
%YAML 1.1
|
||||
---
|
||||
hello: world
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
nixosTests,
|
||||
nodejs_24,
|
||||
nodejs-slim_24,
|
||||
remarshal_0_17,
|
||||
remarshal,
|
||||
nix-update-script,
|
||||
settings ? { },
|
||||
}:
|
||||
@@ -68,7 +68,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
yarnBuildHook
|
||||
nodejs_24
|
||||
# For yaml conversion
|
||||
remarshal_0_17
|
||||
remarshal
|
||||
];
|
||||
doDist = false;
|
||||
meta = {
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
python3Packages,
|
||||
fetchFromGitHub,
|
||||
fetchPypi,
|
||||
fetchpatch,
|
||||
}:
|
||||
|
||||
let
|
||||
packageOverrides = self: super: {
|
||||
tomlkit = super.tomlkit.overridePythonAttrs (oldAttrs: rec {
|
||||
version = "0.12.5";
|
||||
src = fetchPypi {
|
||||
pname = "tomlkit";
|
||||
inherit version;
|
||||
hash = "sha256-7vNPujmDTU1rc8m6fz5NHEF6Tlb4mn6W4JDdDSS4+zw=";
|
||||
};
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
url = "https://github.com/python-poetry/tomlkit/commit/05d9be1c2b2a95a4eb3a53d999f1483dd7abae5a.patch";
|
||||
hash = "sha256-9pLGxcGHs+XoKrqlh7Q0dyc07XrK7J6u2T7Kvfd0ICc=";
|
||||
excludes = [ ".github/workflows/tests.yml" ];
|
||||
})
|
||||
];
|
||||
});
|
||||
};
|
||||
python = python3Packages.python.override (old: {
|
||||
self = python3Packages.python;
|
||||
packageOverrides = lib.composeExtensions (old.packageOverrides or (_: _: { })) packageOverrides;
|
||||
});
|
||||
pythonPackages = python.pkgs;
|
||||
in
|
||||
pythonPackages.buildPythonApplication (finalAttrs: {
|
||||
pname = "remarshal";
|
||||
version = "0.17.1"; # last version with YAML 1.1 support, do not update
|
||||
pyproject = true;
|
||||
|
||||
__structuredAttrs = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "remarshal-project";
|
||||
repo = "remarshal";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-2WxMh5P/8NvElymnMU3JzQU0P4DMXFF6j15OxLaS+VA=";
|
||||
};
|
||||
|
||||
pythonRemoveDeps = [ "pytest" ];
|
||||
|
||||
build-system = [ pythonPackages.poetry-core ];
|
||||
|
||||
dependencies = with pythonPackages; [
|
||||
cbor2
|
||||
colorama
|
||||
python-dateutil
|
||||
pyyaml
|
||||
rich-argparse
|
||||
ruamel-yaml
|
||||
tomlkit
|
||||
u-msgpack-python
|
||||
];
|
||||
|
||||
pythonRelaxDeps = [ "cbor2" ];
|
||||
|
||||
nativeCheckInputs = [ pythonPackages.pytestCheckHook ];
|
||||
|
||||
# nixpkgs-update: no auto update
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/remarshal-project/remarshal/releases/tag/${finalAttrs.src.tag}";
|
||||
description = "Convert between TOML, YAML and JSON";
|
||||
license = lib.licenses.mit;
|
||||
homepage = "https://github.com/remarshal-project/remarshal";
|
||||
maintainers = with lib.maintainers; [ hexa ];
|
||||
mainProgram = "remarshal";
|
||||
};
|
||||
})
|
||||
@@ -167,16 +167,16 @@ optionalAttrs allowAliases aliases
|
||||
generate =
|
||||
name: value:
|
||||
pkgs.callPackage (
|
||||
{ runCommand, remarshal_0_17 }:
|
||||
{ runCommand, remarshal }:
|
||||
runCommand name
|
||||
{
|
||||
nativeBuildInputs = [ remarshal_0_17 ];
|
||||
nativeBuildInputs = [ remarshal ];
|
||||
inherit value;
|
||||
preferLocalBuild = true;
|
||||
__structuredAttrs = true;
|
||||
}
|
||||
''
|
||||
json2yaml ${
|
||||
remarshal --from json --to yaml-1.1 ${
|
||||
# attributes with null values are omitted from the JSON with structured attrs
|
||||
# yaml_1_1Null test keeps this in check
|
||||
if value == null then ''<(echo "null")'' else ''--unwrap value "$NIX_ATTRS_JSON_FILE"''
|
||||
|
||||
@@ -168,6 +168,8 @@ runBuildTests {
|
||||
time = "22:30:00";
|
||||
};
|
||||
expected = ''
|
||||
%YAML 1.1
|
||||
---
|
||||
attrs:
|
||||
foo: null
|
||||
'false': false
|
||||
@@ -188,8 +190,9 @@ runBuildTests {
|
||||
format = formats.yaml_1_1 { };
|
||||
input = null;
|
||||
expected = ''
|
||||
null
|
||||
...
|
||||
%YAML 1.1
|
||||
---
|
||||
null
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
@@ -2084,6 +2084,7 @@ mapAliases {
|
||||
redpanda = throw "'redpanda' has been renamed to/replaced by 'redpanda-client'"; # Converted to throw 2025-10-27
|
||||
redshift-plasma-applet = throw "'redshift-plasma-applet' has been removed as it is obsolete and lacks maintenance upstream."; # Added 2025-11-09
|
||||
reiserfsprogs = throw "'reiserfsprogs' has been removed as ReiserFS has not been actively maintained for many years."; # Added 2025-11-13
|
||||
remarshal_0_17 = throw "'remarshal_0_17' has been removed because 'remarshal' supports YAML 1.1 with the `--to yaml-1.1` flag."; # added 2026-07-30
|
||||
remodel = throw "'remodel' has been removed because it was unmaintained upstream, deprecated in favor of 'lune'"; # Added 2026-05-08
|
||||
remotebox = throw "remotebox has been removed because it was unmaintained and broken for a long time"; # Added 2025-09-11
|
||||
resp-app = throw "'resp-app' has been replaced by 'redisinsight'"; # Added 2025-12-17
|
||||
|
||||
@@ -54,7 +54,7 @@ let
|
||||
meta.description = "Release-critical packages from the python package sets";
|
||||
constituents = [
|
||||
jobs.nixos-render-docs.x86_64-linux # Used in nixos manual
|
||||
jobs.remarshal_0_17.x86_64-linux # Used in pkgs.formats.yaml_1_1
|
||||
jobs.remarshal.x86_64-linux # Used in pkgs.formats.yaml_1_1
|
||||
jobs.python313Packages.afdko.x86_64-linux # Used in noto-fonts-color-emoji
|
||||
jobs.python313Packages.buildcatrust.x86_64-linux # Used in pkgs.cacert
|
||||
jobs.python313Packages.colorama.x86_64-linux # Used in nixos test-driver
|
||||
|
||||
Reference in New Issue
Block a user