lix/src/nix/print-dev-env.md
Valentin Gagarin 2af9fd20c6 clarify definition of "installable"
the term was hard to discover, as its definition and explanation were in
a very long document lacking an overview section.
search did not help because it occurs so often.

- clarify wording in the definition
- add an overview of installable types
- add "installable" to glossary
- link to definition from occurrences of the term
- be more precise about where store derivation outputs are processed
- installable Nix expressions must evaluate to a derivation

Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>
2023-03-05 01:46:17 +01:00

1.1 KiB

R""(

Examples

  • Apply the build environment of GNU hello to the current shell:

    # . <(nix print-dev-env nixpkgs#hello)
    
  • Get the build environment in JSON format:

    # nix print-dev-env nixpkgs#hello --json
    

    The output will look like this:

    {
      "bashFunctions": {
        "buildPhase": " \n    runHook preBuild;\n...",
        ...
      },
      "variables": {
        "src": {
          "type": "exported",
          "value": "/nix/store/3x7dwzq014bblazs7kq20p9hyzz0qh8g-hello-2.10.tar.gz"
        },
        "postUnpackHooks": {
          "type": "array",
          "value": ["_updateSourceDateEpochFromSourceRoot"]
        },
        ...
      }
    }
    

Description

This command prints a shell script that can be sourced by bash and that sets the variables and shell functions defined by the build process of installable. This allows you to get a similar build environment in your current shell rather than in a subshell (as with nix develop).

With --json, the output is a JSON serialisation of the variables and functions defined by the build process.

)""