From 97c3fa4ebd116c8e4983325afb87e5e7043cd092 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 17 Nov 2024 15:01:16 +0100 Subject: [PATCH] hocon: remove deprecated indicators This was scheduled for 24.11. --- pkgs/pkgs-lib/formats/hocon/default.nix | 39 +---------- .../test/backwards-compatibility/default.nix | 65 ------------------- .../test/backwards-compatibility/expected.txt | 22 ------- pkgs/pkgs-lib/formats/hocon/test/default.nix | 11 ---- 4 files changed, 1 insertion(+), 136 deletions(-) delete mode 100644 pkgs/pkgs-lib/formats/hocon/test/backwards-compatibility/default.nix delete mode 100644 pkgs/pkgs-lib/formats/hocon/test/backwards-compatibility/expected.txt diff --git a/pkgs/pkgs-lib/formats/hocon/default.nix b/pkgs/pkgs-lib/formats/hocon/default.nix index 3be57061bb53..696e600740fa 100644 --- a/pkgs/pkgs-lib/formats/hocon/default.nix +++ b/pkgs/pkgs-lib/formats/hocon/default.nix @@ -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; diff --git a/pkgs/pkgs-lib/formats/hocon/test/backwards-compatibility/default.nix b/pkgs/pkgs-lib/formats/hocon/test/backwards-compatibility/default.nix deleted file mode 100644 index 8b9196b16428..000000000000 --- a/pkgs/pkgs-lib/formats/hocon/test/backwards-compatibility/default.nix +++ /dev/null @@ -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 - ''; - } diff --git a/pkgs/pkgs-lib/formats/hocon/test/backwards-compatibility/expected.txt b/pkgs/pkgs-lib/formats/hocon/test/backwards-compatibility/expected.txt deleted file mode 100644 index 2835a3c6ca39..000000000000 --- a/pkgs/pkgs-lib/formats/hocon/test/backwards-compatibility/expected.txt +++ /dev/null @@ -1,22 +0,0 @@ -{ - "literal" = [ - 1, - "a", - ] - "nested" = { - "literal" = [ - 1, - "a", - ] - "substitution" = ${?PATH} - } - "nested_in_array" = [ - ${?PATH}, - [ - 1, - "a", - ] - ] - "substitution" = ${?PATH} -} - diff --git a/pkgs/pkgs-lib/formats/hocon/test/default.nix b/pkgs/pkgs-lib/formats/hocon/test/default.nix index 19928703b95e..6cd03fe4854f 100644 --- a/pkgs/pkgs-lib/formats/hocon/test/default.nix +++ b/pkgs/pkgs-lib/formats/hocon/test/default.nix @@ -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 { }; }