Deprecations

{inputs}: time: body: let
  l = inputs.nixpkgs.lib // builtins;
  ansi = import ./ansi.nix;
  pad = s: let
    n = 17;
    prefix = l.concatStringsSep "" (l.genList (_: " ") (n - (l.stringLength s)));
  in
    prefix + s;
  indent = s: let
    n = 5;
    prefix = l.concatStringsSep "" (l.genList (_: " ") n);
    lines = l.splitString "\n" s;
  in
    "  📝 │ " + (l.concatStringsSep "\n${prefix}│ " lines);
  warn = let
    apply =
      l.replaceStrings
      (map (key: "{${key}}") (l.attrNames ansi))
      (l.attrValues ansi);
  in
    msg:
      l.trace (apply "🔥 {bold}{196}Standard Deprecation Notices - {220}run `std check' to show!{reset}")
      l.traceVerbose (apply "\n{202}${msg}{reset}");
in
  warn ''
    ─────┬─────────────────────────────────────────────────────────────────────────
      💪 │ {bold}Action Required !{un-bold}
    ─────┼─────────────────────────────────────────────────────────────────────────
    {italic}${indent body}{un-italic}
    ─────┼─────────────────────────────────────────────────────────────────────────
      📅 │ {bold}Scheduled Removal: ${pad time}{un-bold}
    ─────┴─────────────────────────────────────────────────────────────────────────
  ''

Please observe the following deprecations and their deprecation schedule:

inputs: let
  removeBy = import ./cells/std/errors/removeBy.nix {inherit inputs;};
in {
  warnOldActionInterface = actions:
    removeBy "March 2023" ''
      The action interface has chaged from:
        { system, flake, fragment, fragmentRelPath }
      To:
        { system, target, fragment, fragmentRelPath }

      Please adjust the following actions:

      ${builtins.concatStringsSep "\n" (map (a: " - ${a.name}: ${(builtins.unsafeGetAttrPos "name" a).file}") actions)}
    '';

  warnNixagoOutfactored = removeBy "May 2023" ''
    std.presets.nixago has been outfactored into its own repository.

    Add to your flake.nix

    inputs.std-data-collection.url = "github:divnix/std-data-collection";
    inputs.std-data-collection.inputs.std.follows = "std";
    inputs.std-data-collection.inputs.nixpkgs.follows = "nixpkgs";

    Replace accessors of
      `inputs.std.presets.nixago`
    with
      `inputs.std-data-collection.data.configs`
  '';

  warnNixagoMoved = removeBy "May 2023" ''
    In order to improve semantic clarity,
    std.std.nixago has been moved to std.lib.cfg.

    Replace accessors of
      `inputs.std.std.nixago`
    with
      `inputs.std.lib.cfg`
  '';
  warnLegacyTag = removeBy "July 2023" ''
    The legacy upstream nix2container tag interface is deprecated,
    std.lib.ops.mkStandardOCI now takes a list of tags via `meta`.

    Replace `tag` input of `mkStandardOCI` function
      mkStandardOCI {tag = "foo";/* ... */}
    with
      mkStandardOCI {meta.tags = ["foo"]; /* ... */}
  '';
}