query
On this page

writeFish

pkgs.writers.writeFish

Functor
Docs pulled from | This Revision | 44 minutes ago


Like writeScript but the first line is a shebang to fish

Can be called with or without extra arguments.

pkgs.writers.writeFish without arguments

writeFish "example" ''
  echo hello world
''

pkgs.writers.writeFish with arguments

writeFish "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.

writeFish =
    name: argsOrScript:
    if lib.isAttrs argsOrScript && !lib.isDerivation argsOrScript then
      makeScriptWriter (
        argsOrScript
        // {
          interpreter = "${lib.getExe pkgs.fish} --no-config";
          check = "${lib.getExe pkgs.fish} --no-config --no-execute"; # syntax check only
        }
      ) name
    else
      makeScriptWriter {
        interpreter = "${lib.getExe pkgs.fish} --no-config";
        check = "${lib.getExe pkgs.fish} --no-config --no-execute"; # syntax check only
      } name argsOrScript;