query
On this page

writeNim

pkgs.writers.writeNim

Functor
Docs pulled from | This Revision | 10 minutes ago


writeNim takes a name, an attrset with an optional Nim compiler, and some Nim source code, returning an executable.

Examples

pkgs.writers.writeNim usage example

  writeNim "hello-nim" { nim = pkgs.nim2; } ''
    echo "hello nim"
  '';

Noogle detected

This is a Functor

Learn about functors

Implementation

The following is the current implementation of this function.

writeNim =
    name:
    {
      makeWrapperArgs ? [ ],
      nim ? pkgs.nim2,
      nimCompileOptions ? { },
      strip ? true,
    }:
    let
      nimCompileCmdArgs = lib.cli.toGNUCommandLineShell { optionValueSeparator = ":"; } (
        {
          d = "release";
          nimcache = ".";
        }
        // nimCompileOptions
      );
    in
    makeBinWriter {
      compileScript = ''
        cp $contentPath tmp.nim
        ${lib.getExe nim} compile ${nimCompileCmdArgs} tmp.nim
        mv tmp $out
      '';
      inherit makeWrapperArgs strip;
    } name;