hocon: remove deprecated indicators
This was scheduled for 24.11.
This commit is contained in:
parent
352f462ad9
commit
97c3fa4ebd
@ -101,43 +101,6 @@ in
|
||||
lib = hoconLib;
|
||||
|
||||
generate = name: value:
|
||||
let
|
||||
# TODO: remove in 24.11
|
||||
# Backwards compatibility for generators in the following locations:
|
||||
# - nixos/modules/services/networking/jibri/default.nix (__hocon_envvar)
|
||||
# - nixos/modules/services/networking/jicofo.nix (__hocon_envvar, __hocon_unquoted_string)
|
||||
# - nixos/modules/services/networking/jitsi-videobridge.nix (__hocon_envvar)
|
||||
replaceOldIndicators = value:
|
||||
if lib.isAttrs value then
|
||||
(if value ? "__hocon_envvar"
|
||||
then
|
||||
lib.warn ''
|
||||
Use of `__hocon_envvar` has been deprecated, and will
|
||||
be removed in the future.
|
||||
|
||||
Please use `(pkgs.formats.hocon {}).lib.mkSubstitution` instead.
|
||||
''
|
||||
(hoconLib.mkSubstitution value.__hocon_envvar)
|
||||
else if value ? "__hocon_unquoted_string"
|
||||
then
|
||||
lib.warn ''
|
||||
Use of `__hocon_unquoted_string` has been deprecated, and will
|
||||
be removed in the future.
|
||||
|
||||
Please make use of the freeform options of
|
||||
`(pkgs.formats.hocon {}).format` instead.
|
||||
''
|
||||
{
|
||||
value = value.__hocon_unquoted_string;
|
||||
_type = "unquoted_string";
|
||||
}
|
||||
else lib.mapAttrs (_: replaceOldIndicators) value)
|
||||
else if lib.isList value
|
||||
then map replaceOldIndicators value
|
||||
else value;
|
||||
|
||||
finalValue = replaceOldIndicators value;
|
||||
in
|
||||
callPackage
|
||||
({
|
||||
stdenvNoCC
|
||||
@ -151,7 +114,7 @@ in
|
||||
dontUnpack = true;
|
||||
preferLocalBuild = true;
|
||||
|
||||
json = builtins.toJSON finalValue;
|
||||
json = builtins.toJSON value;
|
||||
passAsFile = [ "json" ];
|
||||
|
||||
strictDeps = true;
|
||||
|
@ -1,65 +0,0 @@
|
||||
{ formats, stdenvNoCC, ... }:
|
||||
let
|
||||
hocon = formats.hocon { };
|
||||
|
||||
expression = {
|
||||
substitution = { __hocon_envvar = "PATH"; };
|
||||
literal = {
|
||||
__hocon_unquoted_string = ''
|
||||
[
|
||||
1,
|
||||
"a",
|
||||
]'';
|
||||
};
|
||||
|
||||
nested = {
|
||||
substitution = { __hocon_envvar = "PATH"; };
|
||||
literal = {
|
||||
__hocon_unquoted_string = ''
|
||||
[
|
||||
1,
|
||||
"a",
|
||||
]'';
|
||||
};
|
||||
};
|
||||
|
||||
nested_in_array = [
|
||||
{ __hocon_envvar = "PATH"; }
|
||||
{
|
||||
__hocon_unquoted_string = ''
|
||||
[
|
||||
1,
|
||||
"a",
|
||||
]'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
hocon-test-conf = hocon.generate "hocon-test.conf" expression;
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "pkgs.formats.hocon-test-backwards-compatibility";
|
||||
|
||||
dontUnpack = true;
|
||||
dontBuild = true;
|
||||
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
diff -U3 ${./expected.txt} ${hocon-test-conf}
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir $out
|
||||
cp ${./expected.txt} $out/expected.txt
|
||||
cp ${hocon-test-conf} $out/hocon-test.conf
|
||||
cp ${hocon-test-conf.passthru.json} $out/hocon-test.json
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"literal" = [
|
||||
1,
|
||||
"a",
|
||||
]
|
||||
"nested" = {
|
||||
"literal" = [
|
||||
1,
|
||||
"a",
|
||||
]
|
||||
"substitution" = ${?PATH}
|
||||
}
|
||||
"nested_in_array" = [
|
||||
${?PATH},
|
||||
[
|
||||
1,
|
||||
"a",
|
||||
]
|
||||
]
|
||||
"substitution" = ${?PATH}
|
||||
}
|
||||
|
@ -1,15 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
comprehensive = pkgs.callPackage ./comprehensive { };
|
||||
backwards-compatibility =
|
||||
let
|
||||
pkgsNoWarn = pkgs.extend (final: prev: {
|
||||
lib = prev.lib.extend (libFinal: libPrev: {
|
||||
warn = msg: v: v;
|
||||
trivial = libPrev.trivial // {
|
||||
warn = msg: v: v;
|
||||
};
|
||||
});
|
||||
});
|
||||
in pkgsNoWarn.callPackage ./backwards-compatibility { };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user