query
On this page

writeJSON

pkgs.writers.writeJSON

Functor
Docs pulled from | This Revision | 18 days ago


Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.

Noogle detected

This is a Functor

Learn about functors

Implementation

The following is the current implementation of this function.

name: value:
        pkgs.callPackage (
          { runCommand, jq }:
          runCommand name
            {
              nativeBuildInputs = [ jq ];
              inherit value;
              preferLocalBuild = true;
              __structuredAttrs = true;
            }
            # NIX_ATTRS_JSON_FILE won't have `value` if it's null, but jq returns null for missing properties anyway
            # jsonNull test keeps this in check
            ''
              jq .value "$NIX_ATTRS_JSON_FILE" > $out
            ''
        ) { }