query
On this page

writeNu

pkgs.writers.writeNu

Functor
Docs pulled from | This Revision | 10 minutes ago


Like writeScript but the first line is a shebang to nu

Can be called with or without extra arguments.

Examples

pkgs.writers.writeNu without arguments

writeNu "example" ''
  echo hello world
''

pkgs.writers.writeNu with arguments

writeNu "example"
  {
    makeWrapperArgs = [
      "--prefix" "PATH" ":" "${lib.makeBinPath [ pkgs.hello ]}"
    ];
  }
  ''
    hello
  ''

Noogle detected

This is a Functor

Learn about functors

Implementation

The following is the current implementation of this function.

writeNu =
    name: argsOrScript:
    if lib.isAttrs argsOrScript && !lib.isDerivation argsOrScript then
      makeScriptWriter (
        argsOrScript // { interpreter = "${lib.getExe pkgs.nushell} --no-config-file"; }
      ) name
    else
      makeScriptWriter { interpreter = "${lib.getExe pkgs.nushell} --no-config-file"; } name argsOrScript;