Skip to content

Deprecate helpers.mkRaw in favour of lib.generators.mkLuaInline #1935

@MattSturgeon

Description

@MattSturgeon

Overview

Historically we have used our own mkRaw which produces an attrset that looks like { __raw = expr; }, however nixpkgs has had mkLuaInline for a while now (for use with its toLua generator). The nixpkgs function produces an attrset that looks like { _type = "lua-inline"; inherit expr; }.

We should add support for this in our toLua and begin transitioning usage of mkRaw to mkLuaInline.

Eventually we can deprecate our function in favour of mkLuaInline.

Even further in the future, we can deprecate __raw support in toLua.

See upstream usage in lib.generators.toLua and lib.generators.mkLuaInline definition.

TODO

  • helpers.lua.mkLua should support nixpkg's "lua-inline" type. lib/lua: support nixpkg's "lua-inline" type #2012
  • Transition internal __raw to use mkLuaInline
  • Documentation should recommend mkLuaInline
  • Add a deprecation warning to helpers.mkRaw
  • (eventually) Add a deprecation warning to toLua when encountering __raw

Note: there's now also a lib.generators.toLua in nixpkgs, however we currently can't use it, because it has no support for mixed list+attrs tables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech debtRelated to technical debt and/or refactoring

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions