# What is the difference between \`placeholder "out"\` and \`$out\`

**URL:** https://discourse.nixos.org/t/what-is-the-difference-between-placeholder-out-and-out/4862
**Category:** Help
**Created:** [November 20, 2019, 6:30am UTC](https://discourse.nixos.org/t/what-is-the-difference-between-placeholder-out-and-out/4862 "2019-11-20T06:30:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Vonfry](https://discourse.nixos.org/user_avatar/discourse.nixos.org/vonfry/32/910_2.png) [@Vonfry](https://discourse.nixos.org/u/Vonfry)
#### Post date: [November 20, 2019, 6:30am UTC](https://discourse.nixos.org/t/what-is-the-difference-between-placeholder-out-and-out/4862/1 "2019-11-20T06:30:30Z")

</div>

I find nixpkgs use `placeholder "out"` instead of `$out`. But why? Are there any benefits?

By the way, I cannot find `placeholder` in the nix manual.

---

<div class="post-metadata">

### Author: ![layus](https://discourse.nixos.org/user_avatar/discourse.nixos.org/layus/32/125_2.png) [@layus](https://discourse.nixos.org/u/layus)
#### Post date: [November 20, 2019, 11:02am UTC](https://discourse.nixos.org/t/what-is-the-difference-between-placeholder-out-and-out/4862/2 "2019-11-20T11:02:02Z")

</div>

Well, `$out` is a shell variable that is only defined once you enter the build environment. You can use it in any bash snippet, typically in `buildPhase`, `installPhase` and all the `pre/postStuff`. In some rare cases however, you need to reference `$out` in a place where it it not accessible, or not convenient to use `$out` itself. For example if you want to use it in a string built by nix and included in the derivation in such a way that it does not go through variable expansion in bash. `$(placeholder "out")` was designed for such cases. `$out` should always be preferred when possible, so just have a look at `placeholder uses to find examples of situations that require it.

The (scarce) documentation is in the Nix manual, (not to be confused with the nixpkgs manual, or the nixos manual) in the release notes of v2.0. See [Introduction - Nix Reference Manual](https://nixos.org/nix/manual/#ssec-relnotes-2.0) and search for “placeholder”.
