Canonical no-op / dummy package from Nixpkgs?

Is there a standard no-op / dummy / do-nothing package in Nixpkgs? I’ve been using

no-op = derivation {
  name = "no-op";
  system = builtins.currentSystem
  builder = "/bin/sh";
  args = [ "-c" "echo > $out" ];
};

(I have a few miscellaneous questions tangentially related to this.)

  1. Is there an easy way to make an empty folder instead of a empty file without pulling in any additional dependencies? I tried using mkdir but it’s not available.
nix-repl> :b derivation { name = "no-op"; system = builtins.currentSystem; builder = "/bin/sh"; args = ["-c" "mkdir $out"]; }
error: builder for '/nix/store/k9ap5rjkyhan49f220w4c7vqmj2lq0rs-no-op.drv' failed with exit code 127;
       last 1 log lines:
       > sh: mkdir: not found
       For full logs, run 'nix-store -l /nix/store/k9ap5rjkyhan49f220w4c7vqmj2lq0rs-no-op.drv'.
[0 built (1 failed)]
  1. What is /bin/sh in the build sandbox? I thought it was pkgs.busybox-sandbox-shell (see this issue and this commit) but that shell does seem to have mkdir.
nix run nixpkgs#busybox-sandbox-shell "sh"


BusyBox v1.36.1 () built-in shell (ash)

$ mkdir
mkdir: missing operand
Try 'mkdir --help' for more information.
1 Like

The mkdir is from your $PATH, you can tell by running which mkdir.

Or

$ nix shell nixpkgs#busybox-sandbox-shell --command busybox mkdir
mkdir: applet not found
2 Likes

pkgs.emptyDirectory

3 Likes

Accordingly, there is also pkgs.emptyFile.

3 Likes

Oops, you’re exactly right about the $PATH leakage.

Thanks all! Unfortunately Discourse only allows me to mark one answer as a solution, but thanks everyone for answering all three of my questions.