query
On this page

runCommandWith

pkgs.runCommandWith

Docs pulled from | This Revision | 9 minutes ago


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

Noogle detected

Implementation

The following is the current implementation of this function.

{
      # which stdenv to use, defaults to a stdenv with a C compiler, pkgs.stdenv
      stdenv ? defaultStdenv,
      # whether to build this derivation locally instead of substituting
      runLocal ? false,
      # extra arguments to pass to stdenv.mkDerivation
      derivationArgs ? { },
      # name of the resulting derivation
      name,
      # TODO(@Artturin): enable strictDeps always
    }:
    buildCommand:
    stdenv.mkDerivation (
      {
        enableParallelBuilding = true;
        inherit buildCommand name;
        passAsFile = [ "buildCommand" ] ++ (derivationArgs.passAsFile or [ ]);
      }
      // {
        ${if !derivationArgs ? meta then "pos" else null} =
          let
            args = builtins.attrNames derivationArgs;
          in
          if builtins.length args > 0 then
            builtins.unsafeGetAttrPos (builtins.head args) derivationArgs
          else
            null;
        ${if runLocal then "preferLocalBuild" else null} = true;
        ${if runLocal then "allowSubstitutes" else null} = false;
      }
      // removeAttrs derivationArgs [ "passAsFile" ]
    )