docs/Nixpkgs/Standard-Environment/stdenv.chapter/index.html

6767 lines
236 KiB
HTML
Raw Permalink Normal View History

2024-07-24 19:14:02 +00:00
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Aux Documentation">
<meta name="author" content="Nixpkgs Aux, and Lix Contributors">
<link rel="canonical" href="https://docs.auxolotl.org/Nixpkgs/Standard-Environment/stdenv.chapter/">
<link rel="prev" href="../platform-notes.chapter/">
<link rel="next" href="../../Using-Nixpkgs/">
<link rel="icon" href="../../../assets/aux-logo.svg">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.29">
<title>The Standard Environment - Aux Docs</title>
<link rel="stylesheet" href="../../../assets/stylesheets/main.76a95c52.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/palette.06af60db.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.bunny.net/css?family=IBM+Plex+Sans:300,300i,400,400i,700,700i%7CIBM+Plex+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"IBM Plex Sans";--md-code-font:"IBM Plex Mono"}</style>
<script>__md_scope=new URL("../../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
<meta property="og:type" content="website" >
<meta property="og:title" content="The Standard Environment {#chap-stdenv} - Aux Docs" >
<meta property="og:description" content="Aux Documentation" >
<meta property="og:image" content="https://docs.auxolotl.org/assets/images/social/Nixpkgs/Standard-Environment/stdenv.chapter.png" >
<meta property="og:image:type" content="image/png" >
<meta property="og:image:width" content="1200" >
<meta property="og:image:height" content="630" >
<meta property="og:url" content="https://docs.auxolotl.org/Nixpkgs/Standard-Environment/stdenv.chapter/" >
<meta name="twitter:card" content="summary_large_image" >
<meta name="twitter:title" content="The Standard Environment {#chap-stdenv} - Aux Docs" >
<meta name="twitter:description" content="Aux Documentation" >
<meta name="twitter:image" content="https://docs.auxolotl.org/assets/images/social/Nixpkgs/Standard-Environment/stdenv.chapter.png" >
</head>
<body dir="ltr" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="blue">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#chap-stdenv" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="../../.." title="Aux Docs" class="md-header__button md-logo" aria-label="Aux Docs" data-md-component="logo">
<img src="../../../assets/aux-logo.svg" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Aux Docs
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
The Standard Environment
</span>
</div>
</div>
</div>
<form class="md-header__option" data-md-component="palette">
<input class="md-option" data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="blue" aria-label="Dark Mode" type="radio" name="__palette" id="__palette_0">
<label class="md-header__button md-icon" title="Dark Mode" for="__palette_1" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m17.75 4.09-2.53 1.94.91 3.06-2.63-1.81-2.63 1.81.91-3.06-2.53-1.94L12.44 4l1.06-3 1.06 3 3.19.09m3.5 6.91-1.64 1.25.59 1.98-1.7-1.17-1.7 1.17.59-1.98L15.75 11l2.06-.05L18.5 9l.69 1.95 2.06.05m-2.28 4.95c.83-.08 1.72 1.1 1.19 1.85-.32.45-.66.87-1.08 1.27C15.17 23 8.84 23 4.94 19.07c-3.91-3.9-3.91-10.24 0-14.14.4-.4.82-.76 1.27-1.08.75-.53 1.93.36 1.85 1.19-.27 2.86.69 5.83 2.89 8.02a9.96 9.96 0 0 0 8.02 2.89m-1.64 2.02a12.08 12.08 0 0 1-7.8-3.47c-2.17-2.19-3.33-5-3.49-7.82-2.81 3.14-2.7 7.96.31 10.98 3.02 3.01 7.84 3.12 10.98.31Z"/></svg>
</label>
<input class="md-option" data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme="slate" data-md-color-primary="indigo" data-md-color-accent="blue" aria-label="Light Mode" type="radio" name="__palette" id="__palette_1">
<label class="md-header__button md-icon" title="Light Mode" for="__palette_0" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 7a5 5 0 0 1 5 5 5 5 0 0 1-5 5 5 5 0 0 1-5-5 5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0-7 2.39 3.42C13.65 5.15 12.84 5 12 5c-.84 0-1.65.15-2.39.42L12 2M3.34 7l4.16-.35A7.2 7.2 0 0 0 5.94 8.5c-.44.74-.69 1.5-.83 2.29L3.34 7m.02 10 1.76-3.77a7.131 7.131 0 0 0 2.38 4.14L3.36 17M20.65 7l-1.77 3.79a7.023 7.023 0 0 0-2.38-4.15l4.15.36m-.01 10-4.14.36c.59-.51 1.12-1.14 1.54-1.86.42-.73.69-1.5.83-2.29L20.64 17M12 22l-2.41-3.44c.74.27 1.55.44 2.41.44.82 0 1.63-.17 2.37-.44L12 22Z"/></svg>
</label>
</form>
<script>var media,input,key,value,palette=__md_get("__palette");if(palette&&palette.color){"(prefers-color-scheme)"===palette.color.media&&(media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']"),palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent"));for([key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://git.auxolotl.org/auxolotl/docs" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.777 0a2.9 2.9 0 1 1-2.529 4.322H12.91a4.266 4.266 0 0 0-4.265 4.195v2.118a7.076 7.076 0 0 1 4.147-1.42l.118-.002h1.338a2.9 2.9 0 0 1 5.43 1.422 2.9 2.9 0 0 1-5.43 1.422H12.91a4.266 4.266 0 0 0-4.265 4.195v2.319A2.9 2.9 0 0 1 7.222 24 2.9 2.9 0 0 1 5.8 18.57V8.589a7.109 7.109 0 0 1 6.991-7.108l.118-.001h1.338A2.9 2.9 0 0 1 16.778 0ZM7.223 19.905a1.194 1.194 0 1 0 0 2.389 1.194 1.194 0 0 0 0-2.389Zm9.554-10.464a1.194 1.194 0 1 0 0 2.389 1.194 1.194 0 0 0 0-2.39Zm0-7.735a1.194 1.194 0 1 0 0 2.389 1.194 1.194 0 0 0 0-2.389Z"/></svg>
</div>
<div class="md-source__repository">
auxolotl/docs
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<nav class="md-tabs" aria-label="Tabs" data-md-component="tabs">
<div class="md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item">
<a href="../../.." class="md-tabs__link">
Aux Documentation Hub
</a>
</li>
<li class="md-tabs__item">
<a href="../../../TODO/" class="md-tabs__link">
TODO
</a>
</li>
<li class="md-tabs__item">
<a href="../../../Aux/" class="md-tabs__link">
Aux
</a>
</li>
<li class="md-tabs__item">
<a href="../../../Lix/" class="md-tabs__link">
Lix
</a>
</li>
<li class="md-tabs__item">
<a href="../../../NixOS/appstream/" class="md-tabs__link">
NixOS
</a>
</li>
<li class="md-tabs__item md-tabs__item--active">
<a href="../../" class="md-tabs__link">
Nixpkgs
</a>
</li>
</ul>
</div>
</nav>
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="../../.." title="Aux Docs" class="md-nav__button md-logo" aria-label="Aux Docs" data-md-component="logo">
<img src="../../../assets/aux-logo.svg" alt="logo">
</a>
Aux Docs
</label>
<div class="md-nav__source">
<a href="https://git.auxolotl.org/auxolotl/docs" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.777 0a2.9 2.9 0 1 1-2.529 4.322H12.91a4.266 4.266 0 0 0-4.265 4.195v2.118a7.076 7.076 0 0 1 4.147-1.42l.118-.002h1.338a2.9 2.9 0 0 1 5.43 1.422 2.9 2.9 0 0 1-5.43 1.422H12.91a4.266 4.266 0 0 0-4.265 4.195v2.319A2.9 2.9 0 0 1 7.222 24 2.9 2.9 0 0 1 5.8 18.57V8.589a7.109 7.109 0 0 1 6.991-7.108l.118-.001h1.338A2.9 2.9 0 0 1 16.778 0ZM7.223 19.905a1.194 1.194 0 1 0 0 2.389 1.194 1.194 0 0 0 0-2.389Zm9.554-10.464a1.194 1.194 0 1 0 0 2.389 1.194 1.194 0 0 0 0-2.39Zm0-7.735a1.194 1.194 0 1 0 0 2.389 1.194 1.194 0 0 0 0-2.389Z"/></svg>
</div>
<div class="md-source__repository">
auxolotl/docs
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../.." class="md-nav__link">
<span class="md-ellipsis">
Aux Documentation Hub
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../TODO/" class="md-nav__link">
<span class="md-ellipsis">
TODO
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../../Aux/" class="md-nav__link">
<span class="md-ellipsis">
Aux
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../../Lix/" class="md-nav__link">
<span class="md-ellipsis">
Lix
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../../NixOS/appstream/" class="md-nav__link">
<span class="md-ellipsis">
NixOS
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" checked>
<div class="md-nav__link md-nav__container">
<a href="../../" class="md-nav__link ">
<span class="md-ellipsis">
Nixpkgs
</span>
</a>
<label class="md-nav__link " for="__nav_6" id="__nav_6_label" tabindex="">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_6">
<span class="md-nav__icon md-icon"></span>
Nixpkgs
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../options/" class="md-nav__link">
<span class="md-ellipsis">
Options
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../Build-Helpers/" class="md-nav__link">
<span class="md-ellipsis">
Build Helpers
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../Development/" class="md-nav__link">
<span class="md-ellipsis">
Development
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../Functions/" class="md-nav__link">
<span class="md-ellipsis">
Functions
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../Hooks/" class="md-nav__link">
<span class="md-ellipsis">
Hooks
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../Languages-And-Frameworks/" class="md-nav__link">
<span class="md-ellipsis">
Languages And Frameworks
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../Library-Reference/asserts/" class="md-nav__link">
<span class="md-ellipsis">
Library Reference
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../Module-System/module-system.chapter/" class="md-nav__link">
<span class="md-ellipsis">
Module System
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../Packages/" class="md-nav__link">
<span class="md-ellipsis">
Packages
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6_11" checked>
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<span class="md-ellipsis">
Standard Environment
</span>
</a>
<label class="md-nav__link " for="__nav_6_11" id="__nav_6_11_label" tabindex="0">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_6_11_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_6_11">
<span class="md-nav__icon md-icon"></span>
Standard Environment
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../cross-compilation.chapter/" class="md-nav__link">
<span class="md-ellipsis">
Cross-compilation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../meta.chapter/" class="md-nav__link">
<span class="md-ellipsis">
Meta-attributes
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../multiple-output.chapter/" class="md-nav__link">
<span class="md-ellipsis">
Multiple-output packages
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../passthru.chapter/" class="md-nav__link">
<span class="md-ellipsis">
Passthru-attributes
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../platform-notes.chapter/" class="md-nav__link">
<span class="md-ellipsis">
Platform Notes
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
The Standard Environment
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
The Standard Environment
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#sec-using-stdenv" class="md-nav__link">
<span class="md-ellipsis">
Using stdenv
</span>
</a>
<nav class="md-nav" aria-label="Using stdenv">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#sec-building-stdenv-package-in-nix-shell" class="md-nav__link">
<span class="md-ellipsis">
Building a stdenv package in nix-shell
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#sec-tools-of-stdenv" class="md-nav__link">
<span class="md-ellipsis">
Tools provided by stdenv
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#ssec-stdenv-dependencies" class="md-nav__link">
<span class="md-ellipsis">
Specifying dependencies
</span>
</a>
<nav class="md-nav" aria-label="Specifying dependencies">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#ssec-stdenv-dependencies-overview" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
<nav class="md-nav" aria-label="Overview">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#ssec-stdenv-dependencies-overview-example" class="md-nav__link">
<span class="md-ellipsis">
Example
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-stdenv-dependencies-reference" class="md-nav__link">
<span class="md-ellipsis">
Reference
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#ssec-stdenv-dependencies-propagated" class="md-nav__link">
<span class="md-ellipsis">
Dependency propagation
</span>
</a>
<nav class="md-nav" aria-label="Dependency propagation">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-specifying-dependencies" class="md-nav__link">
<span class="md-ellipsis">
Variables specifying dependencies
</span>
</a>
<nav class="md-nav" aria-label="Variables specifying dependencies">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-depsBuildBuild" class="md-nav__link">
<span class="md-ellipsis">
depsBuildBuild
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-nativeBuildInputs" class="md-nav__link">
<span class="md-ellipsis">
nativeBuildInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsBuildTarget" class="md-nav__link">
<span class="md-ellipsis">
depsBuildTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsHostHost" class="md-nav__link">
<span class="md-ellipsis">
depsHostHost
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-buildInputs" class="md-nav__link">
<span class="md-ellipsis">
buildInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsTargetTarget" class="md-nav__link">
<span class="md-ellipsis">
depsTargetTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsBuildBuildPropagated" class="md-nav__link">
<span class="md-ellipsis">
depsBuildBuildPropagated
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-propagatedNativeBuildInputs" class="md-nav__link">
<span class="md-ellipsis">
propagatedNativeBuildInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsBuildTargetPropagated" class="md-nav__link">
<span class="md-ellipsis">
depsBuildTargetPropagated
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsHostHostPropagated" class="md-nav__link">
<span class="md-ellipsis">
depsHostHostPropagated
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-propagatedBuildInputs" class="md-nav__link">
<span class="md-ellipsis">
propagatedBuildInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsTargetTargetPropagated" class="md-nav__link">
<span class="md-ellipsis">
depsTargetTargetPropagated
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-stdenv-attributes" class="md-nav__link">
<span class="md-ellipsis">
Attributes
</span>
</a>
<nav class="md-nav" aria-label="Attributes">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-affecting-stdenv-initialisation" class="md-nav__link">
<span class="md-ellipsis">
Variables affecting stdenv initialisation
</span>
</a>
<nav class="md-nav" aria-label="Variables affecting stdenv initialisation">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-NIX_DEBUG" class="md-nav__link">
<span class="md-ellipsis">
NIX_DEBUG
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#attributes-affecting-build-properties" class="md-nav__link">
<span class="md-ellipsis">
Attributes affecting build properties
</span>
</a>
<nav class="md-nav" aria-label="Attributes affecting build properties">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-enableParallelBuilding" class="md-nav__link">
<span class="md-ellipsis">
enableParallelBuilding
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#mkderivation-recursive-attributes" class="md-nav__link">
<span class="md-ellipsis">
Fixed-point arguments of mkDerivation
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#sec-stdenv-phases" class="md-nav__link">
<span class="md-ellipsis">
Phases
</span>
</a>
<nav class="md-nav" aria-label="Phases">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#ssec-controlling-phases" class="md-nav__link">
<span class="md-ellipsis">
Controlling phases
</span>
</a>
<nav class="md-nav" aria-label="Controlling phases">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-affecting-phase-control" class="md-nav__link">
<span class="md-ellipsis">
Variables affecting phase control
</span>
</a>
<nav class="md-nav" aria-label="Variables affecting phase control">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-phases" class="md-nav__link">
<span class="md-ellipsis">
phases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-prePhases" class="md-nav__link">
<span class="md-ellipsis">
prePhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preConfigurePhases" class="md-nav__link">
<span class="md-ellipsis">
preConfigurePhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preBuildPhases" class="md-nav__link">
<span class="md-ellipsis">
preBuildPhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preInstallPhases" class="md-nav__link">
<span class="md-ellipsis">
preInstallPhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preFixupPhases" class="md-nav__link">
<span class="md-ellipsis">
preFixupPhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preDistPhases" class="md-nav__link">
<span class="md-ellipsis">
preDistPhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postPhases" class="md-nav__link">
<span class="md-ellipsis">
postPhases
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-unpack-phase" class="md-nav__link">
<span class="md-ellipsis">
The unpack phase
</span>
</a>
<nav class="md-nav" aria-label="The unpack phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#tar-files" class="md-nav__link">
<span class="md-ellipsis">
Tar files
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#zip-files" class="md-nav__link">
<span class="md-ellipsis">
Zip files
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#directories-in-the-nix-store" class="md-nav__link">
<span class="md-ellipsis">
Directories in the Nix store
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#variables-controlling-the-unpack-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the unpack phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the unpack phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-src" class="md-nav__link">
<span class="md-ellipsis">
srcs / src
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-sourceRoot" class="md-nav__link">
<span class="md-ellipsis">
sourceRoot
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-setSourceRoot" class="md-nav__link">
<span class="md-ellipsis">
setSourceRoot
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preUnpack" class="md-nav__link">
<span class="md-ellipsis">
preUnpack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postUnpack" class="md-nav__link">
<span class="md-ellipsis">
postUnpack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontUnpack" class="md-nav__link">
<span class="md-ellipsis">
dontUnpack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontMakeSourcesWritable" class="md-nav__link">
<span class="md-ellipsis">
dontMakeSourcesWritable
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-unpackCmd" class="md-nav__link">
<span class="md-ellipsis">
unpackCmd
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-patch-phase" class="md-nav__link">
<span class="md-ellipsis">
The patch phase
</span>
</a>
<nav class="md-nav" aria-label="The patch phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-patch-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the patch phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the patch phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-dontPatch" class="md-nav__link">
<span class="md-ellipsis">
dontPatch
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-patches" class="md-nav__link">
<span class="md-ellipsis">
patches
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-patchFlags" class="md-nav__link">
<span class="md-ellipsis">
patchFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-prePatch" class="md-nav__link">
<span class="md-ellipsis">
prePatch
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postPatch" class="md-nav__link">
<span class="md-ellipsis">
postPatch
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-configure-phase" class="md-nav__link">
<span class="md-ellipsis">
The configure phase
</span>
</a>
<nav class="md-nav" aria-label="The configure phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-configure-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the configure phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the configure phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-configureScript" class="md-nav__link">
<span class="md-ellipsis">
configureScript
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-configureFlags" class="md-nav__link">
<span class="md-ellipsis">
configureFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontConfigure" class="md-nav__link">
<span class="md-ellipsis">
dontConfigure
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-configureFlagsArray" class="md-nav__link">
<span class="md-ellipsis">
configureFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontAddPrefix" class="md-nav__link">
<span class="md-ellipsis">
dontAddPrefix
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-prefix" class="md-nav__link">
<span class="md-ellipsis">
prefix
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-prefixKey" class="md-nav__link">
<span class="md-ellipsis">
prefixKey
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontAddStaticConfigureFlags" class="md-nav__link">
<span class="md-ellipsis">
dontAddStaticConfigureFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontAddDisableDepTrack" class="md-nav__link">
<span class="md-ellipsis">
dontAddDisableDepTrack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontFixLibtool" class="md-nav__link">
<span class="md-ellipsis">
dontFixLibtool
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontDisableStatic" class="md-nav__link">
<span class="md-ellipsis">
dontDisableStatic
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-configurePlatforms" class="md-nav__link">
<span class="md-ellipsis">
configurePlatforms
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preConfigure" class="md-nav__link">
<span class="md-ellipsis">
preConfigure
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postConfigure" class="md-nav__link">
<span class="md-ellipsis">
postConfigure
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#build-phase" class="md-nav__link">
<span class="md-ellipsis">
The build phase
</span>
</a>
<nav class="md-nav" aria-label="The build phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-build-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the build phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the build phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-dontBuild" class="md-nav__link">
<span class="md-ellipsis">
dontBuild
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-makefile" class="md-nav__link">
<span class="md-ellipsis">
makefile
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-makeFlags" class="md-nav__link">
<span class="md-ellipsis">
makeFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-makeFlagsArray" class="md-nav__link">
<span class="md-ellipsis">
makeFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-buildFlags" class="md-nav__link">
<span class="md-ellipsis">
buildFlags / buildFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preBuild" class="md-nav__link">
<span class="md-ellipsis">
preBuild
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postBuild" class="md-nav__link">
<span class="md-ellipsis">
postBuild
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-check-phase" class="md-nav__link">
<span class="md-ellipsis">
The check phase
</span>
</a>
<nav class="md-nav" aria-label="The check phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-check-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the check phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the check phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-doCheck" class="md-nav__link">
<span class="md-ellipsis">
doCheck
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#makeflags-makeflagsarray-makefile" class="md-nav__link">
<span class="md-ellipsis">
makeFlags / makeFlagsArray / makefile
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-checkTarget" class="md-nav__link">
<span class="md-ellipsis">
checkTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-checkFlags" class="md-nav__link">
<span class="md-ellipsis">
checkFlags / checkFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-checkInputs" class="md-nav__link">
<span class="md-ellipsis">
checkInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-nativeCheckInputs" class="md-nav__link">
<span class="md-ellipsis">
nativeCheckInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preCheck" class="md-nav__link">
<span class="md-ellipsis">
preCheck
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postCheck" class="md-nav__link">
<span class="md-ellipsis">
postCheck
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-install-phase" class="md-nav__link">
<span class="md-ellipsis">
The install phase
</span>
</a>
<nav class="md-nav" aria-label="The install phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-install-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the install phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the install phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-dontInstall" class="md-nav__link">
<span class="md-ellipsis">
dontInstall
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#makeflags-makeflagsarray-makefile-1" class="md-nav__link">
<span class="md-ellipsis">
makeFlags / makeFlagsArray / makefile
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-installTargets" class="md-nav__link">
<span class="md-ellipsis">
installTargets
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-installFlags" class="md-nav__link">
<span class="md-ellipsis">
installFlags / installFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preInstall" class="md-nav__link">
<span class="md-ellipsis">
preInstall
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postInstall" class="md-nav__link">
<span class="md-ellipsis">
postInstall
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-fixup-phase" class="md-nav__link">
<span class="md-ellipsis">
The fixup phase
</span>
</a>
<nav class="md-nav" aria-label="The fixup phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-fixup-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the fixup phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the fixup phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-dontFixup" class="md-nav__link">
<span class="md-ellipsis">
dontFixup
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontStrip" class="md-nav__link">
<span class="md-ellipsis">
dontStrip
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontStripHost" class="md-nav__link">
<span class="md-ellipsis">
dontStripHost
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontStripTarget" class="md-nav__link">
<span class="md-ellipsis">
dontStripTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontMoveSbin" class="md-nav__link">
<span class="md-ellipsis">
dontMoveSbin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripAllList" class="md-nav__link">
<span class="md-ellipsis">
stripAllList
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripAllListTarget" class="md-nav__link">
<span class="md-ellipsis">
stripAllListTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripAllFlags" class="md-nav__link">
<span class="md-ellipsis">
stripAllFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripDebugList" class="md-nav__link">
<span class="md-ellipsis">
stripDebugList
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripDebugListTarget" class="md-nav__link">
<span class="md-ellipsis">
stripDebugListTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripDebugFlags" class="md-nav__link">
<span class="md-ellipsis">
stripDebugFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripExclude" class="md-nav__link">
<span class="md-ellipsis">
stripExclude
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontPatchELF" class="md-nav__link">
<span class="md-ellipsis">
dontPatchELF
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontPatchShebangs" class="md-nav__link">
<span class="md-ellipsis">
dontPatchShebangs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontPruneLibtoolFiles" class="md-nav__link">
<span class="md-ellipsis">
dontPruneLibtoolFiles
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-forceShare" class="md-nav__link">
<span class="md-ellipsis">
forceShare
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-setupHook" class="md-nav__link">
<span class="md-ellipsis">
setupHook
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preFixup" class="md-nav__link">
<span class="md-ellipsis">
preFixup
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postFixup" class="md-nav__link">
<span class="md-ellipsis">
postFixup
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#stdenv-separateDebugInfo" class="md-nav__link">
<span class="md-ellipsis">
separateDebugInfo
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-installCheck-phase" class="md-nav__link">
<span class="md-ellipsis">
The installCheck phase
</span>
</a>
<nav class="md-nav" aria-label="The installCheck phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-installcheck-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the installCheck phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the installCheck phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-doInstallCheck" class="md-nav__link">
<span class="md-ellipsis">
doInstallCheck
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-installCheckTarget" class="md-nav__link">
<span class="md-ellipsis">
installCheckTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-installCheckFlags" class="md-nav__link">
<span class="md-ellipsis">
installCheckFlags / installCheckFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-installCheckInputs" class="md-nav__link">
<span class="md-ellipsis">
installCheckInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-nativeInstallCheckInputs" class="md-nav__link">
<span class="md-ellipsis">
nativeInstallCheckInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preInstallCheck" class="md-nav__link">
<span class="md-ellipsis">
preInstallCheck
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postInstallCheck" class="md-nav__link">
<span class="md-ellipsis">
postInstallCheck
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-distribution-phase" class="md-nav__link">
<span class="md-ellipsis">
The distribution phase
</span>
</a>
<nav class="md-nav" aria-label="The distribution phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-distribution-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the distribution phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the distribution phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-doDist" class="md-nav__link">
<span class="md-ellipsis">
doDist
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-distTarget" class="md-nav__link">
<span class="md-ellipsis">
distTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-distFlags" class="md-nav__link">
<span class="md-ellipsis">
distFlags / distFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-tarballs" class="md-nav__link">
<span class="md-ellipsis">
tarballs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontCopyDist" class="md-nav__link">
<span class="md-ellipsis">
dontCopyDist
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preDist" class="md-nav__link">
<span class="md-ellipsis">
preDist
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postDist" class="md-nav__link">
<span class="md-ellipsis">
postDist
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-stdenv-functions" class="md-nav__link">
<span class="md-ellipsis">
Shell functions and utilities
</span>
</a>
<nav class="md-nav" aria-label="Shell functions and utilities">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#fun-makeWrapper" class="md-nav__link">
<span class="md-ellipsis">
makeWrapper \&lt;executable> \&lt;wrapperfile> \&lt;args>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-remove-references-to" class="md-nav__link">
<span class="md-ellipsis">
remove-references-to -t \&lt;storepath> [ -t \&lt;storepath> ... ] \&lt;file> ...
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substitute" class="md-nav__link">
<span class="md-ellipsis">
substitute \&lt;infile> \&lt;outfile> \&lt;subs>
</span>
</a>
<nav class="md-nav" aria-label="substitute \<infile> \<outfile> \<subs>">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#fun-substitute-replace-fail" class="md-nav__link">
<span class="md-ellipsis">
--replace-fail \&lt;s1> \&lt;s2>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substitute-replace-warn" class="md-nav__link">
<span class="md-ellipsis">
--replace-warn \&lt;s1> \&lt;s2>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substitute-replace-quiet" class="md-nav__link">
<span class="md-ellipsis">
--replace-quiet \&lt;s1> \&lt;s2>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substitute-subst-var" class="md-nav__link">
<span class="md-ellipsis">
--subst-var \&lt;varName>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substitute-subst-var-by" class="md-nav__link">
<span class="md-ellipsis">
--subst-var-by \&lt;varName> \&lt;s>
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#fun-substituteInPlace" class="md-nav__link">
<span class="md-ellipsis">
substituteInPlace \&lt;multiple files> \&lt;subs>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substituteAll" class="md-nav__link">
<span class="md-ellipsis">
substituteAll \&lt;infile> \&lt;outfile>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substituteAllInPlace" class="md-nav__link">
<span class="md-ellipsis">
substituteAllInPlace \&lt;file>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-stripHash" class="md-nav__link">
<span class="md-ellipsis">
stripHash \&lt;path>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-wrapProgram" class="md-nav__link">
<span class="md-ellipsis">
wrapProgram \&lt;executable> \&lt;makeWrapperArgs>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-prependToVar" class="md-nav__link">
<span class="md-ellipsis">
prependToVar \&lt;variableName> \&lt;elements...>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-appendToVar" class="md-nav__link">
<span class="md-ellipsis">
appendToVar \&lt;variableName> \&lt;elements...>
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-setup-hooks" class="md-nav__link">
<span class="md-ellipsis">
Package setup hooks
</span>
</a>
<nav class="md-nav" aria-label="Package setup hooks">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#move-docs.sh" class="md-nav__link">
<span class="md-ellipsis">
move-docs.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#compress-man-pages.sh" class="md-nav__link">
<span class="md-ellipsis">
compress-man-pages.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#strip.sh" class="md-nav__link">
<span class="md-ellipsis">
strip.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#patch-shebangs.sh" class="md-nav__link">
<span class="md-ellipsis">
patch-shebangs.sh
</span>
</a>
<nav class="md-nav" aria-label="patch-shebangs.sh">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#patch-shebangs.sh-invocation" class="md-nav__link">
<span class="md-ellipsis">
Invocation
</span>
</a>
<nav class="md-nav" aria-label="Invocation">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#patch-shebangs.sh-invocation-flags" class="md-nav__link">
<span class="md-ellipsis">
Flags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#patch-shebangs.sh-invocation-examples" class="md-nav__link">
<span class="md-ellipsis">
Examples
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#audit-tmpdir.sh" class="md-nav__link">
<span class="md-ellipsis">
audit-tmpdir.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#multiple-outputs.sh" class="md-nav__link">
<span class="md-ellipsis">
multiple-outputs.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#move-sbin.sh" class="md-nav__link">
<span class="md-ellipsis">
move-sbin.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#move-lib64.sh" class="md-nav__link">
<span class="md-ellipsis">
move-lib64.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#move-systemd-user-units.sh" class="md-nav__link">
<span class="md-ellipsis">
move-systemd-user-units.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#set-source-date-epoch-to-latest.sh" class="md-nav__link">
<span class="md-ellipsis">
set-source-date-epoch-to-latest.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#bintools-wrapper" class="md-nav__link">
<span class="md-ellipsis">
Bintools Wrapper and hook
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#cc-wrapper" class="md-nav__link">
<span class="md-ellipsis">
CC Wrapper and hook
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#stdenv-other-hooks" class="md-nav__link">
<span class="md-ellipsis">
Other hooks
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#compiler-linker-wrapper-hooks" class="md-nav__link">
<span class="md-ellipsis">
Compiler and Linker wrapper hooks
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#sec-purity-in-nixpkgs" class="md-nav__link">
<span class="md-ellipsis">
Purity in Nixpkgs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#sec-hardening-in-nixpkgs" class="md-nav__link">
<span class="md-ellipsis">
Hardening in Nixpkgs
</span>
</a>
<nav class="md-nav" aria-label="Hardening in Nixpkgs">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#sec-hardening-flags-enabled-by-default" class="md-nav__link">
<span class="md-ellipsis">
Hardening flags enabled by default
</span>
</a>
<nav class="md-nav" aria-label="Hardening flags enabled by default">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#format" class="md-nav__link">
<span class="md-ellipsis">
format
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#stackprotector" class="md-nav__link">
<span class="md-ellipsis">
stackprotector
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fortify" class="md-nav__link">
<span class="md-ellipsis">
fortify
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fortify3" class="md-nav__link">
<span class="md-ellipsis">
fortify3
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#pic" class="md-nav__link">
<span class="md-ellipsis">
pic
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#strictoverflow" class="md-nav__link">
<span class="md-ellipsis">
strictoverflow
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#relro" class="md-nav__link">
<span class="md-ellipsis">
relro
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#bindnow" class="md-nav__link">
<span class="md-ellipsis">
bindnow
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#zerocallusedregs" class="md-nav__link">
<span class="md-ellipsis">
zerocallusedregs
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#sec-hardening-flags-disabled-by-default" class="md-nav__link">
<span class="md-ellipsis">
Hardening flags disabled by default
</span>
</a>
<nav class="md-nav" aria-label="Hardening flags disabled by default">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#pie" class="md-nav__link">
<span class="md-ellipsis">
pie
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#trivialautovarinit" class="md-nav__link">
<span class="md-ellipsis">
trivialautovarinit
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#stackclashprotection" class="md-nav__link">
<span class="md-ellipsis">
stackclashprotection
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../Using-Nixpkgs/" class="md-nav__link">
<span class="md-ellipsis">
Using Nixpkgs
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#sec-using-stdenv" class="md-nav__link">
<span class="md-ellipsis">
Using stdenv
</span>
</a>
<nav class="md-nav" aria-label="Using stdenv">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#sec-building-stdenv-package-in-nix-shell" class="md-nav__link">
<span class="md-ellipsis">
Building a stdenv package in nix-shell
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#sec-tools-of-stdenv" class="md-nav__link">
<span class="md-ellipsis">
Tools provided by stdenv
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#ssec-stdenv-dependencies" class="md-nav__link">
<span class="md-ellipsis">
Specifying dependencies
</span>
</a>
<nav class="md-nav" aria-label="Specifying dependencies">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#ssec-stdenv-dependencies-overview" class="md-nav__link">
<span class="md-ellipsis">
Overview
</span>
</a>
<nav class="md-nav" aria-label="Overview">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#ssec-stdenv-dependencies-overview-example" class="md-nav__link">
<span class="md-ellipsis">
Example
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-stdenv-dependencies-reference" class="md-nav__link">
<span class="md-ellipsis">
Reference
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#ssec-stdenv-dependencies-propagated" class="md-nav__link">
<span class="md-ellipsis">
Dependency propagation
</span>
</a>
<nav class="md-nav" aria-label="Dependency propagation">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-specifying-dependencies" class="md-nav__link">
<span class="md-ellipsis">
Variables specifying dependencies
</span>
</a>
<nav class="md-nav" aria-label="Variables specifying dependencies">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-depsBuildBuild" class="md-nav__link">
<span class="md-ellipsis">
depsBuildBuild
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-nativeBuildInputs" class="md-nav__link">
<span class="md-ellipsis">
nativeBuildInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsBuildTarget" class="md-nav__link">
<span class="md-ellipsis">
depsBuildTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsHostHost" class="md-nav__link">
<span class="md-ellipsis">
depsHostHost
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-buildInputs" class="md-nav__link">
<span class="md-ellipsis">
buildInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsTargetTarget" class="md-nav__link">
<span class="md-ellipsis">
depsTargetTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsBuildBuildPropagated" class="md-nav__link">
<span class="md-ellipsis">
depsBuildBuildPropagated
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-propagatedNativeBuildInputs" class="md-nav__link">
<span class="md-ellipsis">
propagatedNativeBuildInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsBuildTargetPropagated" class="md-nav__link">
<span class="md-ellipsis">
depsBuildTargetPropagated
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsHostHostPropagated" class="md-nav__link">
<span class="md-ellipsis">
depsHostHostPropagated
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-propagatedBuildInputs" class="md-nav__link">
<span class="md-ellipsis">
propagatedBuildInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-depsTargetTargetPropagated" class="md-nav__link">
<span class="md-ellipsis">
depsTargetTargetPropagated
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-stdenv-attributes" class="md-nav__link">
<span class="md-ellipsis">
Attributes
</span>
</a>
<nav class="md-nav" aria-label="Attributes">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-affecting-stdenv-initialisation" class="md-nav__link">
<span class="md-ellipsis">
Variables affecting stdenv initialisation
</span>
</a>
<nav class="md-nav" aria-label="Variables affecting stdenv initialisation">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-NIX_DEBUG" class="md-nav__link">
<span class="md-ellipsis">
NIX_DEBUG
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#attributes-affecting-build-properties" class="md-nav__link">
<span class="md-ellipsis">
Attributes affecting build properties
</span>
</a>
<nav class="md-nav" aria-label="Attributes affecting build properties">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-enableParallelBuilding" class="md-nav__link">
<span class="md-ellipsis">
enableParallelBuilding
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#mkderivation-recursive-attributes" class="md-nav__link">
<span class="md-ellipsis">
Fixed-point arguments of mkDerivation
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#sec-stdenv-phases" class="md-nav__link">
<span class="md-ellipsis">
Phases
</span>
</a>
<nav class="md-nav" aria-label="Phases">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#ssec-controlling-phases" class="md-nav__link">
<span class="md-ellipsis">
Controlling phases
</span>
</a>
<nav class="md-nav" aria-label="Controlling phases">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-affecting-phase-control" class="md-nav__link">
<span class="md-ellipsis">
Variables affecting phase control
</span>
</a>
<nav class="md-nav" aria-label="Variables affecting phase control">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-phases" class="md-nav__link">
<span class="md-ellipsis">
phases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-prePhases" class="md-nav__link">
<span class="md-ellipsis">
prePhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preConfigurePhases" class="md-nav__link">
<span class="md-ellipsis">
preConfigurePhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preBuildPhases" class="md-nav__link">
<span class="md-ellipsis">
preBuildPhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preInstallPhases" class="md-nav__link">
<span class="md-ellipsis">
preInstallPhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preFixupPhases" class="md-nav__link">
<span class="md-ellipsis">
preFixupPhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preDistPhases" class="md-nav__link">
<span class="md-ellipsis">
preDistPhases
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postPhases" class="md-nav__link">
<span class="md-ellipsis">
postPhases
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-unpack-phase" class="md-nav__link">
<span class="md-ellipsis">
The unpack phase
</span>
</a>
<nav class="md-nav" aria-label="The unpack phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#tar-files" class="md-nav__link">
<span class="md-ellipsis">
Tar files
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#zip-files" class="md-nav__link">
<span class="md-ellipsis">
Zip files
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#directories-in-the-nix-store" class="md-nav__link">
<span class="md-ellipsis">
Directories in the Nix store
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#variables-controlling-the-unpack-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the unpack phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the unpack phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-src" class="md-nav__link">
<span class="md-ellipsis">
srcs / src
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-sourceRoot" class="md-nav__link">
<span class="md-ellipsis">
sourceRoot
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-setSourceRoot" class="md-nav__link">
<span class="md-ellipsis">
setSourceRoot
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preUnpack" class="md-nav__link">
<span class="md-ellipsis">
preUnpack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postUnpack" class="md-nav__link">
<span class="md-ellipsis">
postUnpack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontUnpack" class="md-nav__link">
<span class="md-ellipsis">
dontUnpack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontMakeSourcesWritable" class="md-nav__link">
<span class="md-ellipsis">
dontMakeSourcesWritable
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-unpackCmd" class="md-nav__link">
<span class="md-ellipsis">
unpackCmd
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-patch-phase" class="md-nav__link">
<span class="md-ellipsis">
The patch phase
</span>
</a>
<nav class="md-nav" aria-label="The patch phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-patch-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the patch phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the patch phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-dontPatch" class="md-nav__link">
<span class="md-ellipsis">
dontPatch
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-patches" class="md-nav__link">
<span class="md-ellipsis">
patches
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-patchFlags" class="md-nav__link">
<span class="md-ellipsis">
patchFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-prePatch" class="md-nav__link">
<span class="md-ellipsis">
prePatch
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postPatch" class="md-nav__link">
<span class="md-ellipsis">
postPatch
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-configure-phase" class="md-nav__link">
<span class="md-ellipsis">
The configure phase
</span>
</a>
<nav class="md-nav" aria-label="The configure phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-configure-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the configure phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the configure phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-configureScript" class="md-nav__link">
<span class="md-ellipsis">
configureScript
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-configureFlags" class="md-nav__link">
<span class="md-ellipsis">
configureFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontConfigure" class="md-nav__link">
<span class="md-ellipsis">
dontConfigure
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-configureFlagsArray" class="md-nav__link">
<span class="md-ellipsis">
configureFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontAddPrefix" class="md-nav__link">
<span class="md-ellipsis">
dontAddPrefix
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-prefix" class="md-nav__link">
<span class="md-ellipsis">
prefix
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-prefixKey" class="md-nav__link">
<span class="md-ellipsis">
prefixKey
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontAddStaticConfigureFlags" class="md-nav__link">
<span class="md-ellipsis">
dontAddStaticConfigureFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontAddDisableDepTrack" class="md-nav__link">
<span class="md-ellipsis">
dontAddDisableDepTrack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontFixLibtool" class="md-nav__link">
<span class="md-ellipsis">
dontFixLibtool
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontDisableStatic" class="md-nav__link">
<span class="md-ellipsis">
dontDisableStatic
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-configurePlatforms" class="md-nav__link">
<span class="md-ellipsis">
configurePlatforms
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preConfigure" class="md-nav__link">
<span class="md-ellipsis">
preConfigure
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postConfigure" class="md-nav__link">
<span class="md-ellipsis">
postConfigure
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#build-phase" class="md-nav__link">
<span class="md-ellipsis">
The build phase
</span>
</a>
<nav class="md-nav" aria-label="The build phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-build-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the build phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the build phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-dontBuild" class="md-nav__link">
<span class="md-ellipsis">
dontBuild
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-makefile" class="md-nav__link">
<span class="md-ellipsis">
makefile
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-makeFlags" class="md-nav__link">
<span class="md-ellipsis">
makeFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-makeFlagsArray" class="md-nav__link">
<span class="md-ellipsis">
makeFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-buildFlags" class="md-nav__link">
<span class="md-ellipsis">
buildFlags / buildFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preBuild" class="md-nav__link">
<span class="md-ellipsis">
preBuild
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postBuild" class="md-nav__link">
<span class="md-ellipsis">
postBuild
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-check-phase" class="md-nav__link">
<span class="md-ellipsis">
The check phase
</span>
</a>
<nav class="md-nav" aria-label="The check phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-check-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the check phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the check phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-doCheck" class="md-nav__link">
<span class="md-ellipsis">
doCheck
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#makeflags-makeflagsarray-makefile" class="md-nav__link">
<span class="md-ellipsis">
makeFlags / makeFlagsArray / makefile
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-checkTarget" class="md-nav__link">
<span class="md-ellipsis">
checkTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-checkFlags" class="md-nav__link">
<span class="md-ellipsis">
checkFlags / checkFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-checkInputs" class="md-nav__link">
<span class="md-ellipsis">
checkInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-nativeCheckInputs" class="md-nav__link">
<span class="md-ellipsis">
nativeCheckInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preCheck" class="md-nav__link">
<span class="md-ellipsis">
preCheck
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postCheck" class="md-nav__link">
<span class="md-ellipsis">
postCheck
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-install-phase" class="md-nav__link">
<span class="md-ellipsis">
The install phase
</span>
</a>
<nav class="md-nav" aria-label="The install phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-install-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the install phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the install phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-dontInstall" class="md-nav__link">
<span class="md-ellipsis">
dontInstall
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#makeflags-makeflagsarray-makefile-1" class="md-nav__link">
<span class="md-ellipsis">
makeFlags / makeFlagsArray / makefile
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-installTargets" class="md-nav__link">
<span class="md-ellipsis">
installTargets
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-installFlags" class="md-nav__link">
<span class="md-ellipsis">
installFlags / installFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preInstall" class="md-nav__link">
<span class="md-ellipsis">
preInstall
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postInstall" class="md-nav__link">
<span class="md-ellipsis">
postInstall
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-fixup-phase" class="md-nav__link">
<span class="md-ellipsis">
The fixup phase
</span>
</a>
<nav class="md-nav" aria-label="The fixup phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-fixup-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the fixup phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the fixup phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-dontFixup" class="md-nav__link">
<span class="md-ellipsis">
dontFixup
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontStrip" class="md-nav__link">
<span class="md-ellipsis">
dontStrip
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontStripHost" class="md-nav__link">
<span class="md-ellipsis">
dontStripHost
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontStripTarget" class="md-nav__link">
<span class="md-ellipsis">
dontStripTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontMoveSbin" class="md-nav__link">
<span class="md-ellipsis">
dontMoveSbin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripAllList" class="md-nav__link">
<span class="md-ellipsis">
stripAllList
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripAllListTarget" class="md-nav__link">
<span class="md-ellipsis">
stripAllListTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripAllFlags" class="md-nav__link">
<span class="md-ellipsis">
stripAllFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripDebugList" class="md-nav__link">
<span class="md-ellipsis">
stripDebugList
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripDebugListTarget" class="md-nav__link">
<span class="md-ellipsis">
stripDebugListTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripDebugFlags" class="md-nav__link">
<span class="md-ellipsis">
stripDebugFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-stripExclude" class="md-nav__link">
<span class="md-ellipsis">
stripExclude
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontPatchELF" class="md-nav__link">
<span class="md-ellipsis">
dontPatchELF
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontPatchShebangs" class="md-nav__link">
<span class="md-ellipsis">
dontPatchShebangs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontPruneLibtoolFiles" class="md-nav__link">
<span class="md-ellipsis">
dontPruneLibtoolFiles
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-forceShare" class="md-nav__link">
<span class="md-ellipsis">
forceShare
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-setupHook" class="md-nav__link">
<span class="md-ellipsis">
setupHook
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preFixup" class="md-nav__link">
<span class="md-ellipsis">
preFixup
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postFixup" class="md-nav__link">
<span class="md-ellipsis">
postFixup
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#stdenv-separateDebugInfo" class="md-nav__link">
<span class="md-ellipsis">
separateDebugInfo
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-installCheck-phase" class="md-nav__link">
<span class="md-ellipsis">
The installCheck phase
</span>
</a>
<nav class="md-nav" aria-label="The installCheck phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-installcheck-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the installCheck phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the installCheck phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-doInstallCheck" class="md-nav__link">
<span class="md-ellipsis">
doInstallCheck
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-installCheckTarget" class="md-nav__link">
<span class="md-ellipsis">
installCheckTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-installCheckFlags" class="md-nav__link">
<span class="md-ellipsis">
installCheckFlags / installCheckFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-installCheckInputs" class="md-nav__link">
<span class="md-ellipsis">
installCheckInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-nativeInstallCheckInputs" class="md-nav__link">
<span class="md-ellipsis">
nativeInstallCheckInputs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preInstallCheck" class="md-nav__link">
<span class="md-ellipsis">
preInstallCheck
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postInstallCheck" class="md-nav__link">
<span class="md-ellipsis">
postInstallCheck
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-distribution-phase" class="md-nav__link">
<span class="md-ellipsis">
The distribution phase
</span>
</a>
<nav class="md-nav" aria-label="The distribution phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#variables-controlling-the-distribution-phase" class="md-nav__link">
<span class="md-ellipsis">
Variables controlling the distribution phase
</span>
</a>
<nav class="md-nav" aria-label="Variables controlling the distribution phase">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#var-stdenv-doDist" class="md-nav__link">
<span class="md-ellipsis">
doDist
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-distTarget" class="md-nav__link">
<span class="md-ellipsis">
distTarget
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-distFlags" class="md-nav__link">
<span class="md-ellipsis">
distFlags / distFlagsArray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-tarballs" class="md-nav__link">
<span class="md-ellipsis">
tarballs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-dontCopyDist" class="md-nav__link">
<span class="md-ellipsis">
dontCopyDist
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-preDist" class="md-nav__link">
<span class="md-ellipsis">
preDist
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#var-stdenv-postDist" class="md-nav__link">
<span class="md-ellipsis">
postDist
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-stdenv-functions" class="md-nav__link">
<span class="md-ellipsis">
Shell functions and utilities
</span>
</a>
<nav class="md-nav" aria-label="Shell functions and utilities">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#fun-makeWrapper" class="md-nav__link">
<span class="md-ellipsis">
makeWrapper \&lt;executable> \&lt;wrapperfile> \&lt;args>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-remove-references-to" class="md-nav__link">
<span class="md-ellipsis">
remove-references-to -t \&lt;storepath> [ -t \&lt;storepath> ... ] \&lt;file> ...
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substitute" class="md-nav__link">
<span class="md-ellipsis">
substitute \&lt;infile> \&lt;outfile> \&lt;subs>
</span>
</a>
<nav class="md-nav" aria-label="substitute \<infile> \<outfile> \<subs>">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#fun-substitute-replace-fail" class="md-nav__link">
<span class="md-ellipsis">
--replace-fail \&lt;s1> \&lt;s2>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substitute-replace-warn" class="md-nav__link">
<span class="md-ellipsis">
--replace-warn \&lt;s1> \&lt;s2>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substitute-replace-quiet" class="md-nav__link">
<span class="md-ellipsis">
--replace-quiet \&lt;s1> \&lt;s2>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substitute-subst-var" class="md-nav__link">
<span class="md-ellipsis">
--subst-var \&lt;varName>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substitute-subst-var-by" class="md-nav__link">
<span class="md-ellipsis">
--subst-var-by \&lt;varName> \&lt;s>
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#fun-substituteInPlace" class="md-nav__link">
<span class="md-ellipsis">
substituteInPlace \&lt;multiple files> \&lt;subs>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substituteAll" class="md-nav__link">
<span class="md-ellipsis">
substituteAll \&lt;infile> \&lt;outfile>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-substituteAllInPlace" class="md-nav__link">
<span class="md-ellipsis">
substituteAllInPlace \&lt;file>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-stripHash" class="md-nav__link">
<span class="md-ellipsis">
stripHash \&lt;path>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-wrapProgram" class="md-nav__link">
<span class="md-ellipsis">
wrapProgram \&lt;executable> \&lt;makeWrapperArgs>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-prependToVar" class="md-nav__link">
<span class="md-ellipsis">
prependToVar \&lt;variableName> \&lt;elements...>
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fun-appendToVar" class="md-nav__link">
<span class="md-ellipsis">
appendToVar \&lt;variableName> \&lt;elements...>
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#ssec-setup-hooks" class="md-nav__link">
<span class="md-ellipsis">
Package setup hooks
</span>
</a>
<nav class="md-nav" aria-label="Package setup hooks">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#move-docs.sh" class="md-nav__link">
<span class="md-ellipsis">
move-docs.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#compress-man-pages.sh" class="md-nav__link">
<span class="md-ellipsis">
compress-man-pages.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#strip.sh" class="md-nav__link">
<span class="md-ellipsis">
strip.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#patch-shebangs.sh" class="md-nav__link">
<span class="md-ellipsis">
patch-shebangs.sh
</span>
</a>
<nav class="md-nav" aria-label="patch-shebangs.sh">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#patch-shebangs.sh-invocation" class="md-nav__link">
<span class="md-ellipsis">
Invocation
</span>
</a>
<nav class="md-nav" aria-label="Invocation">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#patch-shebangs.sh-invocation-flags" class="md-nav__link">
<span class="md-ellipsis">
Flags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#patch-shebangs.sh-invocation-examples" class="md-nav__link">
<span class="md-ellipsis">
Examples
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#audit-tmpdir.sh" class="md-nav__link">
<span class="md-ellipsis">
audit-tmpdir.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#multiple-outputs.sh" class="md-nav__link">
<span class="md-ellipsis">
multiple-outputs.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#move-sbin.sh" class="md-nav__link">
<span class="md-ellipsis">
move-sbin.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#move-lib64.sh" class="md-nav__link">
<span class="md-ellipsis">
move-lib64.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#move-systemd-user-units.sh" class="md-nav__link">
<span class="md-ellipsis">
move-systemd-user-units.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#set-source-date-epoch-to-latest.sh" class="md-nav__link">
<span class="md-ellipsis">
set-source-date-epoch-to-latest.sh
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#bintools-wrapper" class="md-nav__link">
<span class="md-ellipsis">
Bintools Wrapper and hook
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#cc-wrapper" class="md-nav__link">
<span class="md-ellipsis">
CC Wrapper and hook
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#stdenv-other-hooks" class="md-nav__link">
<span class="md-ellipsis">
Other hooks
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#compiler-linker-wrapper-hooks" class="md-nav__link">
<span class="md-ellipsis">
Compiler and Linker wrapper hooks
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#sec-purity-in-nixpkgs" class="md-nav__link">
<span class="md-ellipsis">
Purity in Nixpkgs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#sec-hardening-in-nixpkgs" class="md-nav__link">
<span class="md-ellipsis">
Hardening in Nixpkgs
</span>
</a>
<nav class="md-nav" aria-label="Hardening in Nixpkgs">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#sec-hardening-flags-enabled-by-default" class="md-nav__link">
<span class="md-ellipsis">
Hardening flags enabled by default
</span>
</a>
<nav class="md-nav" aria-label="Hardening flags enabled by default">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#format" class="md-nav__link">
<span class="md-ellipsis">
format
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#stackprotector" class="md-nav__link">
<span class="md-ellipsis">
stackprotector
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fortify" class="md-nav__link">
<span class="md-ellipsis">
fortify
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#fortify3" class="md-nav__link">
<span class="md-ellipsis">
fortify3
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#pic" class="md-nav__link">
<span class="md-ellipsis">
pic
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#strictoverflow" class="md-nav__link">
<span class="md-ellipsis">
strictoverflow
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#relro" class="md-nav__link">
<span class="md-ellipsis">
relro
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#bindnow" class="md-nav__link">
<span class="md-ellipsis">
bindnow
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#zerocallusedregs" class="md-nav__link">
<span class="md-ellipsis">
zerocallusedregs
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#sec-hardening-flags-disabled-by-default" class="md-nav__link">
<span class="md-ellipsis">
Hardening flags disabled by default
</span>
</a>
<nav class="md-nav" aria-label="Hardening flags disabled by default">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#pie" class="md-nav__link">
<span class="md-ellipsis">
pie
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#trivialautovarinit" class="md-nav__link">
<span class="md-ellipsis">
trivialautovarinit
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#stackclashprotection" class="md-nav__link">
<span class="md-ellipsis">
stackclashprotection
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1 id="chap-stdenv">The Standard Environment</h1>
<p>The standard build environment in the Nix Packages collection provides an environment for building Unix packages that does a lot of common build tasks automatically. In fact, for Unix packages that use the standard <code>./configure; make; make install</code> build interface, you dont need to write a build script at all; the standard environment does everything automatically. If <code>stdenv</code> doesnt do what you need automatically, you can easily customise or override the various build phases.</p>
<h2 id="sec-using-stdenv">Using <code>stdenv</code></h2>
<p>To build a package with the standard environment, you use the function <code>stdenv.mkDerivation</code>, instead of the primitive built-in function <code>derivation</code>, e.g.</p>
<div class="highlight"><pre><span></span><code>stdenv<span class="o">.</span>mkDerivation <span class="p">{</span>
<span class="ss">name</span> <span class="o">=</span> <span class="s2">&quot;libfoo-1.2.3&quot;</span><span class="p">;</span>
<span class="ss">src</span> <span class="o">=</span> fetchurl <span class="p">{</span>
<span class="ss">url</span> <span class="o">=</span> <span class="s2">&quot;http://example.org/libfoo-1.2.3.tar.bz2&quot;</span><span class="p">;</span>
<span class="ss">hash</span> <span class="o">=</span> <span class="s2">&quot;sha256-tWxU/LANbQE32my+9AXyt3nCT7NBVfJ45CX757EMT3Q=&quot;</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
</code></pre></div>
<p>(<code>stdenv</code> needs to be in scope, so if you write this in a separate Nix expression from <code>pkgs/all-packages.nix</code>, you need to pass it as a function argument.) Specifying a <code>name</code> and a <code>src</code> is the absolute minimum Nix requires. For convenience, you can also use <code>pname</code> and <code>version</code> attributes and <code>mkDerivation</code> will automatically set <code>name</code> to <code>"${pname}-${version}"</code> by default.
<strong>Since <a href="https://github.com/NixOS/rfcs/pull/35">RFC 0035</a>, this is preferred for packages in Nixpkgs</strong>, as it allows us to reuse the version easily:</p>
<div class="highlight"><pre><span></span><code>stdenv<span class="o">.</span>mkDerivation <span class="k">rec</span> <span class="p">{</span>
<span class="ss">pname</span> <span class="o">=</span> <span class="s2">&quot;libfoo&quot;</span><span class="p">;</span>
<span class="ss">version</span> <span class="o">=</span> <span class="s2">&quot;1.2.3&quot;</span><span class="p">;</span>
<span class="ss">src</span> <span class="o">=</span> fetchurl <span class="p">{</span>
<span class="ss">url</span> <span class="o">=</span> <span class="s2">&quot;http://example.org/libfoo-source-</span><span class="si">${</span>version<span class="si">}</span><span class="s2">.tar.bz2&quot;</span><span class="p">;</span>
<span class="ss">hash</span> <span class="o">=</span> <span class="s2">&quot;sha256-tWxU/LANbQE32my+9AXyt3nCT7NBVfJ45CX757EMT3Q=&quot;</span><span class="p">;</span>
<span class="p">};</span>
<span class="p">}</span>
</code></pre></div>
<p>Many packages have dependencies that are not provided in the standard environment. Its usually sufficient to specify those dependencies in the <code>buildInputs</code> attribute:</p>
<div class="highlight"><pre><span></span><code>stdenv<span class="o">.</span>mkDerivation <span class="p">{</span>
<span class="ss">pname</span> <span class="o">=</span> <span class="s2">&quot;libfoo&quot;</span><span class="p">;</span>
<span class="ss">version</span> <span class="o">=</span> <span class="s2">&quot;1.2.3&quot;</span><span class="p">;</span>
<span class="c1"># ...</span>
<span class="ss">buildInputs</span> <span class="o">=</span> <span class="p">[</span>libbar perl ncurses<span class="p">];</span>
<span class="p">}</span>
</code></pre></div>
<p>This attribute ensures that the <code>bin</code> subdirectories of these packages appear in the <code>PATH</code> environment variable during the build, that their <code>include</code> subdirectories are searched by the C compiler, and so on. (See <a href="#ssec-setup-hooks"></a> for details.)</p>
<p>Often it is necessary to override or modify some aspect of the build. To make this easier, the standard environment breaks the package build into a number of <em>phases</em>, all of which can be overridden or modified individually: unpacking the sources, applying patches, configuring, building, and installing. (There are some others; see <a href="#sec-stdenv-phases"></a>.) For instance, a package that doesnt supply a makefile but instead has to be compiled "manually" could be handled like this:</p>
<div class="highlight"><pre><span></span><code>stdenv<span class="o">.</span>mkDerivation <span class="p">{</span>
<span class="ss">pname</span> <span class="o">=</span> <span class="s2">&quot;fnord&quot;</span><span class="p">;</span>
<span class="ss">version</span> <span class="o">=</span> <span class="s2">&quot;4.5&quot;</span><span class="p">;</span>
<span class="c1"># ...</span>
<span class="ss">buildPhase</span> <span class="o">=</span> <span class="s s-Multiline">&#39;&#39;</span>
<span class="s s-Multiline"> gcc foo.c -o foo</span>
<span class="s s-Multiline"> &#39;&#39;</span><span class="p">;</span>
<span class="ss">installPhase</span> <span class="o">=</span> <span class="s s-Multiline">&#39;&#39;</span>
<span class="s s-Multiline"> mkdir -p $out/bin</span>
<span class="s s-Multiline"> cp foo $out/bin</span>
<span class="s s-Multiline"> &#39;&#39;</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
<p>(Note the use of <code>''</code>-style string literals, which are very convenient for large multi-line script fragments because they dont need escaping of <code>"</code> and <code>\</code>, and because indentation is intelligently removed.)</p>
<p>There are many other attributes to customise the build. These are listed in <a href="#ssec-stdenv-attributes"></a>.</p>
<p>While the standard environment provides a generic builder, you can still supply your own build script:</p>
<div class="highlight"><pre><span></span><code>stdenv<span class="o">.</span>mkDerivation <span class="p">{</span>
<span class="ss">pname</span> <span class="o">=</span> <span class="s2">&quot;libfoo&quot;</span><span class="p">;</span>
<span class="ss">version</span> <span class="o">=</span> <span class="s2">&quot;1.2.3&quot;</span><span class="p">;</span>
<span class="c1"># ...</span>
<span class="ss">builder</span> <span class="o">=</span> <span class="l">./builder.sh</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
<p>where the builder can do anything it wants, but typically starts with</p>
<div class="highlight"><pre><span></span><code><span class="nb">source</span><span class="w"> </span><span class="nv">$stdenv</span>/setup
</code></pre></div>
<p>to let <code>stdenv</code> set up the environment (e.g. by resetting <code>PATH</code> and populating it from build inputs). If you want, you can still use <code>stdenv</code>s generic builder:</p>
<div class="highlight"><pre><span></span><code><span class="nb">source</span><span class="w"> </span><span class="nv">$stdenv</span>/setup
buildPhase<span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="w"> </span><span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;... this is my custom build phase ...&quot;</span>
<span class="w"> </span>gcc<span class="w"> </span>foo.c<span class="w"> </span>-o<span class="w"> </span>foo
<span class="o">}</span>
installPhase<span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="w"> </span>mkdir<span class="w"> </span>-p<span class="w"> </span><span class="nv">$out</span>/bin
<span class="w"> </span>cp<span class="w"> </span>foo<span class="w"> </span><span class="nv">$out</span>/bin
<span class="o">}</span>
genericBuild
</code></pre></div>
<h3 id="sec-building-stdenv-package-in-nix-shell">Building a <code>stdenv</code> package in <code>nix-shell</code></h3>
<p>To build a <code>stdenv</code> package in a <a href="https://nixos.org/manual/nix/unstable/command-ref/nix-shell.html"><code>nix-shell</code></a>, enter a shell, find the <a href="#sec-stdenv-phases">phases</a> you wish to build, then invoke <code>genericBuild</code> manually:</p>
<p>Go to an empty directory, invoke <code>nix-shell</code> with the desired package, and from inside the shell, set the output variables to a writable directory:</p>
<div class="highlight"><pre><span></span><code><span class="nb">cd</span><span class="w"> </span><span class="s2">&quot;</span><span class="k">$(</span>mktemp<span class="w"> </span>-d<span class="k">)</span><span class="s2">&quot;</span>
nix-shell<span class="w"> </span><span class="s1">&#39;&lt;nixpkgs&gt;&#39;</span><span class="w"> </span>-A<span class="w"> </span>some_package
<span class="nb">export</span><span class="w"> </span><span class="nv">out</span><span class="o">=</span><span class="k">$(</span><span class="nb">pwd</span><span class="k">)</span>/out
</code></pre></div>
<p>Next, invoke the desired parts of the build.
First, run the phases that generate a working copy of the sources, which will change directory to the sources for you:</p>
<div class="highlight"><pre><span></span><code><span class="nv">phases</span><span class="o">=</span><span class="s2">&quot;</span><span class="si">${</span><span class="nv">prePhases</span><span class="p">[*]</span><span class="k">:-</span><span class="si">}</span><span class="s2"> unpackPhase patchPhase&quot;</span><span class="w"> </span>genericBuild
</code></pre></div>
<p>Then, run more phases up until the failure is reached.
If the failure is in the build or check phase, the following phases would be required:</p>
<div class="highlight"><pre><span></span><code><span class="nv">phases</span><span class="o">=</span><span class="s2">&quot;</span><span class="si">${</span><span class="nv">preConfigurePhases</span><span class="p">[*]</span><span class="k">:-</span><span class="si">}</span><span class="s2"> configurePhase </span><span class="si">${</span><span class="nv">preBuildPhases</span><span class="p">[*]</span><span class="k">:-</span><span class="si">}</span><span class="s2"> buildPhase checkPhase&quot;</span><span class="w"> </span>genericBuild
</code></pre></div>
<p>Use this command to run all install phases:
<div class="highlight"><pre><span></span><code><span class="nv">phases</span><span class="o">=</span><span class="s2">&quot;</span><span class="si">${</span><span class="nv">preInstallPhases</span><span class="p">[*]</span><span class="k">:-</span><span class="si">}</span><span class="s2"> installPhase </span><span class="si">${</span><span class="nv">preFixupPhases</span><span class="p">[*]</span><span class="k">:-</span><span class="si">}</span><span class="s2"> fixupPhase installCheckPhase&quot;</span><span class="w"> </span>genericBuild
</code></pre></div></p>
<p>Single phase can be re-run as many times as necessary to examine the failure like so:</p>
<div class="highlight"><pre><span></span><code><span class="nv">phases</span><span class="o">=</span><span class="s2">&quot;buildPhase&quot;</span><span class="w"> </span>genericBuild
</code></pre></div>
<p>To modify a <a href="#sec-stdenv-phases">phase</a>, first print it with</p>
<div class="highlight"><pre><span></span><code><span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$buildPhase</span><span class="s2">&quot;</span>
</code></pre></div>
<p>Or, if that is empty, for instance, if it is using a function:</p>
<div class="highlight"><pre><span></span><code><span class="nb">type</span><span class="w"> </span>buildPhase
</code></pre></div>
<p>then change it in a text editor, and paste it back to the terminal.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This method may have some inconsistencies in environment variables and behaviour compared to a normal build within the <a href="https://nixos.org/manual/nix/unstable/language/derivations#builder-execution">Nix build sandbox</a>.
The following is a non-exhaustive list of such differences:</p>
</div>
<ul>
<li><code>TMP</code>, <code>TMPDIR</code>, and similar variables likely point to non-empty directories that the build might conflict with files in.</li>
<li>Output store paths are not writable, so the variables for outputs need to be overridden to writable paths.</li>
<li>Other environment variables may be inconsistent with a <code>nix-build</code> either due to <code>nix-shell</code>'s initialization script or due to the use of <code>nix-shell</code> without the <code>--pure</code> option.</li>
</ul>
<p>If the build fails differently inside the shell than in the sandbox, consider using <a href="#breakpointhook"><code>breakpointHook</code></a> and invoking <code>nix-build</code> instead.
The <a href="https://nixos.org/manual/nix/unstable/command-ref/conf-file#opt--keep-failed"><code>--keep-failed</code></a> option for <code>nix-build</code> may also be useful to examine the build directory of a failed build.</p>
<h2 id="sec-tools-of-stdenv">Tools provided by <code>stdenv</code></h2>
<p>The standard environment provides the following packages:</p>
<ul>
<li>The GNU C Compiler, configured with C and C++ support.</li>
<li>GNU coreutils (contains a few dozen standard Unix commands).</li>
<li>GNU findutils (contains <code>find</code>).</li>
<li>GNU diffutils (contains <code>diff</code>, <code>cmp</code>).</li>
<li>GNU <code>sed</code>.</li>
<li>GNU <code>grep</code>.</li>
<li>GNU <code>awk</code>.</li>
<li>GNU <code>tar</code>.</li>
<li><code>gzip</code>, <code>bzip2</code> and <code>xz</code>.</li>
<li>GNU Make.</li>
<li>Bash. This is the shell used for all builders in the Nix Packages collection. Not using <code>/bin/sh</code> removes a large source of portability problems.</li>
<li>The <code>patch</code> command.</li>
</ul>
<p>On Linux, <code>stdenv</code> also includes the <code>patchelf</code> utility.</p>
<h2 id="ssec-stdenv-dependencies">Specifying dependencies</h2>
<p>Build systems often require more dependencies than just what <code>stdenv</code> provides. This section describes attributes accepted by <code>stdenv.mkDerivation</code> that can be used to make these dependencies available to the build system.</p>
<h3 id="ssec-stdenv-dependencies-overview">Overview</h3>
<p>A full reference of the different kinds of dependencies is provided in <a href="#ssec-stdenv-dependencies-reference"></a>, but here is an overview of the most common ones.
It should cover most use cases.</p>
<p>Add dependencies to <code>nativeBuildInputs</code> if they are executed during the build:
- those which are needed on <code>$PATH</code> during the build, for example <code>cmake</code> and <code>pkg-config</code>
- <a href="#ssec-setup-hooks">setup hooks</a>, for example <a href="#fun-makeWrapper"><code>makeWrapper</code></a>
- interpreters needed by <a href="#patch-shebangs.sh"><code>patchShebangs</code></a> for build scripts (with the <code>--build</code> flag), which can be the case for e.g. <code>perl</code></p>
<p>Add dependencies to <code>buildInputs</code> if they will end up copied or linked into the final output or otherwise used at runtime:
- libraries used by compilers, for example <code>zlib</code>,
- interpreters needed by <a href="#patch-shebangs.sh"><code>patchShebangs</code></a> for scripts which are installed, which can be the case for e.g. <code>perl</code></p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>These criteria are independent.</p>
</div>
<p>For example, software using Wayland usually needs the <code>wayland</code> library at runtime, so <code>wayland</code> should be added to <code>buildInputs</code>.
But it also executes the <code>wayland-scanner</code> program as part of the build to generate code, so <code>wayland</code> should also be added to <code>nativeBuildInputs</code>.</p>
<p>Dependencies needed only to run tests are similarly classified between native (executed during build) and non-native (executed at runtime):
- <code>nativeCheckInputs</code> for test tools needed on <code>$PATH</code> (such as <code>ctest</code>) and <a href="#ssec-setup-hooks">setup hooks</a> (for example <a href="#python"><code>pytestCheckHook</code></a>)
- <code>checkInputs</code> for libraries linked into test executables (for example the <code>qcheck</code> OCaml package)</p>
<p>These dependencies are only injected when <a href="#var-stdenv-doCheck"><code>doCheck</code></a> is set to <code>true</code>.</p>
<h4 id="ssec-stdenv-dependencies-overview-example">Example</h4>
<p>Consider for example this simplified derivation for <code>solo5</code>, a sandboxing tool:
<div class="highlight"><pre><span></span><code>stdenv<span class="o">.</span>mkDerivation <span class="k">rec</span> <span class="p">{</span>
<span class="ss">pname</span> <span class="o">=</span> <span class="s2">&quot;solo5&quot;</span><span class="p">;</span>
<span class="ss">version</span> <span class="o">=</span> <span class="s2">&quot;0.7.5&quot;</span><span class="p">;</span>
<span class="ss">src</span> <span class="o">=</span> fetchurl <span class="p">{</span>
<span class="ss">url</span> <span class="o">=</span> <span class="s2">&quot;https://github.com/Solo5/solo5/releases/download/v</span><span class="si">${</span>version<span class="si">}</span><span class="s2">/solo5-v</span><span class="si">${</span>version<span class="si">}</span><span class="s2">.tar.gz&quot;</span><span class="p">;</span>
<span class="ss">hash</span> <span class="o">=</span> <span class="s2">&quot;sha256-viwrS9lnaU8sTGuzK/+L/PlMM/xRRtgVuK5pixVeDEw=&quot;</span><span class="p">;</span>
<span class="p">};</span>
<span class="ss">nativeBuildInputs</span> <span class="o">=</span> <span class="p">[</span> makeWrapper pkg-config <span class="p">];</span>
<span class="ss">buildInputs</span> <span class="o">=</span> <span class="p">[</span> libseccomp <span class="p">];</span>
<span class="ss">postInstall</span> <span class="o">=</span> <span class="s s-Multiline">&#39;&#39;</span>
<span class="s s-Multiline"> substituteInPlace $out/bin/solo5-virtio-mkimage \</span>
<span class="s s-Multiline"> --replace-fail &quot;/usr/lib/syslinux&quot; &quot;</span><span class="si">${</span>syslinux<span class="si">}</span><span class="s s-Multiline">/share/syslinux&quot; \</span>
<span class="s s-Multiline"> --replace-fail &quot;/usr/share/syslinux&quot; &quot;</span><span class="si">${</span>syslinux<span class="si">}</span><span class="s s-Multiline">/share/syslinux&quot; \</span>
<span class="s s-Multiline"> --replace-fail &quot;cp &quot; &quot;cp --no-preserve=mode &quot;</span>
<span class="s s-Multiline"> wrapProgram $out/bin/solo5-virtio-mkimage \</span>
<span class="s s-Multiline"> --prefix PATH : </span><span class="si">${</span>lib<span class="o">.</span>makeBinPath <span class="p">[</span> dosfstools mtools parted syslinux <span class="p">]</span><span class="si">}</span>
<span class="s s-Multiline"> &#39;&#39;</span><span class="p">;</span>
<span class="ss">doCheck</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
<span class="ss">nativeCheckInputs</span> <span class="o">=</span> <span class="p">[</span> util-linux qemu <span class="p">];</span>
<span class="ss">checkPhase</span> <span class="o">=</span> <span class="s s-Multiline">&#39;&#39; [elided] &#39;&#39;</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div></p>
<ul>
<li><code>makeWrapper</code> is a setup hook, i.e., a shell script sourced by the generic builder of <code>stdenv</code>.
It is thus executed during the build and must be added to <code>nativeBuildInputs</code>.</li>
<li><code>pkg-config</code> is a build tool which the configure script of <code>solo5</code> expects to be on <code>$PATH</code> during the build:
therefore, it must be added to <code>nativeBuildInputs</code>.</li>
<li><code>libseccomp</code> is a library linked into <code>$out/bin/solo5-elftool</code>.
As it is used at runtime, it must be added to <code>buildInputs</code>.</li>
<li>Tests need <code>qemu</code> and <code>getopt</code> (from <code>util-linux</code>) on <code>$PATH</code>, these must be added to <code>nativeCheckInputs</code>.</li>
<li>Some dependencies are injected directly in the shell code of phases: <code>syslinux</code>, <code>dosfstools</code>, <code>mtools</code>, and <code>parted</code>.
In this specific case, they will end up in the output of the derivation (<code>$out</code> here).
As Nix marks dependencies whose absolute path is present in the output as runtime dependencies, adding them to <code>buildInputs</code> is not required.</li>
</ul>
<p>For more complex cases, like libraries linked into an executable which is then executed as part of the build system, see <a href="#ssec-stdenv-dependencies-reference"></a>.</p>
<h3 id="ssec-stdenv-dependencies-reference">Reference</h3>
<p>As described in the Nix manual, almost any <code>*.drv</code> store path in a derivations attribute set will induce a dependency on that derivation. <code>mkDerivation</code>, however, takes a few attributes intended to include all the dependencies of a package. This is done both for structure and consistency, but also so that certain other setup can take place. For example, certain dependencies need their bin directories added to the <code>PATH</code>. That is built-in, but other setup is done via a pluggable mechanism that works in conjunction with these dependency attributes. See <a href="#ssec-setup-hooks"></a> for details.</p>
<p>Dependencies can be broken down along these axes: their host and target platforms relative to the new derivations. The platform distinctions are motivated by cross compilation; see <a href="#chap-cross"></a> for exactly what each platform means. [^footnote-stdenv-ignored-build-platform] But even if one is not cross compiling, the platforms imply whether a dependency is needed at run-time or build-time.</p>
<p>The extension of <code>PATH</code> with dependencies, alluded to above, proceeds according to the relative platforms alone. The process is carried out only for dependencies whose host platform matches the new derivations build platform i.e. dependencies which run on the platform where the new derivation will be built. [^footnote-stdenv-native-dependencies-in-path] For each dependency \&lt;dep&gt; of those dependencies, <code>dep/bin</code>, if present, is added to the <code>PATH</code> environment variable.</p>
<h3 id="ssec-stdenv-dependencies-propagated">Dependency propagation</h3>
<p>Propagated dependencies are made available to all downstream dependencies.
This is particularly useful for interpreted languages, where all transitive dependencies have to be present in the same environment.
Therefore it is used for the Python infrastructure in Nixpkgs.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Propagated dependencies should be used with care, because they obscure the actual build inputs of dependent derivations and cause side effects through setup hooks.
This can lead to conflicting dependencies that cannot easily be resolved.</p>
</div>
<div class="admonition example">
<p class="admonition-title">Example</p>
<div class="highlight"><pre><span></span><code># A propagated dependency
</code></pre></div>
<div class="highlight"><pre><span></span><code><span class="k">with</span> <span class="nb">import</span> <span class="l">&lt;nixpkgs&gt;</span> <span class="p">{};</span>
<span class="k">let</span>
<span class="ss">bar</span> <span class="o">=</span> stdenv<span class="o">.</span>mkDerivation <span class="p">{</span>
<span class="ss">name</span> <span class="o">=</span> <span class="s2">&quot;bar&quot;</span><span class="p">;</span>
<span class="ss">dontUnpack</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
<span class="c1"># `hello` is also made available to dependents, such as `foo`</span>
<span class="ss">propagatedBuildInputs</span> <span class="o">=</span> <span class="p">[</span> hello <span class="p">];</span>
<span class="ss">postInstall</span> <span class="o">=</span> <span class="s2">&quot;mkdir $out&quot;</span><span class="p">;</span>
<span class="p">};</span>
<span class="ss">foo</span> <span class="o">=</span> stdenv<span class="o">.</span>mkDerivation <span class="p">{</span>
<span class="ss">name</span> <span class="o">=</span> <span class="s2">&quot;foo&quot;</span><span class="p">;</span>
<span class="ss">dontUnpack</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
<span class="c1"># `bar` is a direct dependency, which implicitly includes the propagated `hello`</span>
<span class="ss">buildInputs</span> <span class="o">=</span> <span class="p">[</span> bar <span class="p">];</span>
<span class="c1"># The `hello` binary is available!</span>
<span class="ss">postInstall</span> <span class="o">=</span> <span class="s2">&quot;hello &gt; $out&quot;</span><span class="p">;</span>
<span class="p">};</span>
<span class="k">in</span>
foo
</code></pre></div>
</div>
<p>Dependency propagation takes cross compilation into account, meaning that dependencies that cross platform boundaries are properly adjusted.</p>
<p>To determine the exact rules for dependency propagation, we start by assigning to each dependency a couple of ternary numbers (<code>-1</code> for <code>build</code>, <code>0</code> for <code>host</code>, and <code>1</code> for <code>target</code>) representing its <a href="#possible-dependency-types">dependency type</a>, which captures how its host and target platforms are each "offset" from the depending derivations host and target platforms. The following table summarize the different combinations that can be obtained:</p>
<table>
<thead>
<tr>
<th><code>host → target</code></th>
<th>attribute name</th>
<th>offset</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>build --&gt; build</code></td>
<td><code>depsBuildBuild</code></td>
<td><code>-1, -1</code></td>
</tr>
<tr>
<td><code>build --&gt; host</code></td>
<td><code>nativeBuildInputs</code></td>
<td><code>-1, 0</code></td>
</tr>
<tr>
<td><code>build --&gt; target</code></td>
<td><code>depsBuildTarget</code></td>
<td><code>-1, 1</code></td>
</tr>
<tr>
<td><code>host --&gt; host</code></td>
<td><code>depsHostHost</code></td>
<td><code>0, 0</code></td>
</tr>
<tr>
<td><code>host --&gt; target</code></td>
<td><code>buildInputs</code></td>
<td><code>0, 1</code></td>
</tr>
<tr>
<td><code>target --&gt; target</code></td>
<td><code>depsTargetTarget</code></td>
<td><code>1, 1</code></td>
</tr>
</tbody>
</table>
<p>Algorithmically, we traverse propagated inputs, accumulating every propagated dependencys propagated dependencies and adjusting them to account for the “shift in perspective” described by the current dependencys platform offsets. This results is sort of a transitive closure of the dependency relation, with the offsets being approximately summed when two dependency links are combined. We also prune transitive dependencies whose combined offsets go out-of-bounds, which can be viewed as a filter over that transitive closure removing dependencies that are blatantly absurd.</p>
<p>We can define the process precisely with <a href="https://en.wikipedia.org/wiki/Natural_deduction">Natural Deduction</a> using the inference rules. This probably seems a bit obtuse, but so is the bash code that actually implements it! [^footnote-stdenv-find-inputs-location] Theyre confusing in very different ways so… hopefully if something doesnt make sense in one presentation, it will in the other!</p>
<div class="highlight"><pre><span></span><code>let mapOffset(h, t, i) = i + (if i &lt;= 0 then h else t - 1)
propagated-dep(h0, t0, A, B)
propagated-dep(h1, t1, B, C)
h0 + h1 in {-1, 0, 1}
h0 + t1 in {-1, 0, 1}
-------------------------------------- Transitive property
propagated-dep(mapOffset(h0, t0, h1),
mapOffset(h0, t0, t1),
A, C)
</code></pre></div>
<div class="highlight"><pre><span></span><code>let mapOffset(h, t, i) = i + (if i &lt;= 0 then h else t - 1)
dep(h0, t0, A, B)
propagated-dep(h1, t1, B, C)
h0 + h1 in {-1, 0, 1}
h0 + t1 in {-1, 0, -1}
----------------------------- Take immediate dependencies&#39; propagated dependencies
propagated-dep(mapOffset(h0, t0, h1),
mapOffset(h0, t0, t1),
A, C)
</code></pre></div>
<div class="highlight"><pre><span></span><code>propagated-dep(h, t, A, B)
----------------------------- Propagated dependencies count as dependencies
dep(h, t, A, B)
</code></pre></div>
<p>Some explanation of this monstrosity is in order. In the common case, the target offset of a dependency is the successor to the target offset: <code>t = h + 1</code>. That means that:</p>
<div class="highlight"><pre><span></span><code>let f(h, t, i) = i + (if i &lt;= 0 then h else t - 1)
let f(h, h + 1, i) = i + (if i &lt;= 0 then h else (h + 1) - 1)
let f(h, h + 1, i) = i + (if i &lt;= 0 then h else h)
let f(h, h + 1, i) = i + h
</code></pre></div>
<p>This is where “sum-like” comes in from above: We can just sum all of the host offsets to get the host offset of the transitive dependency. The target offset is the transitive dependency is the host offset + 1, just as it was with the dependencies composed to make this transitive one; it can be ignored as it doesnt add any new information.</p>
<p>Because of the bounds checks, the uncommon cases are <code>h = t</code> and <code>h + 2 = t</code>. In the former case, the motivation for <code>mapOffset</code> is that since its host and target platforms are the same, no transitive dependency of it should be able to “discover” an offset greater than its reduced target offsets. <code>mapOffset</code> effectively “squashes” all its transitive dependencies offsets so that none will ever be greater than the target offset of the original <code>h = t</code> package. In the other case, <code>h + 1</code> is skipped over between the host and target offsets. Instead of squashing the offsets, we need to “rip” them apart so no transitive dependencies offset is that one.</p>
<p>Overall, the unifying theme here is that propagation shouldnt be introducing transitive dependencies involving platforms the depending package is unaware of. [One can imagine the depending package asking for dependencies with the platforms it knows about; other platforms it doesnt know how to ask for. The platform description in that scenario is a kind of unforgeable capability.] The offset bounds checking and definition of <code>mapOffset</code> together ensure that this is the case. Discovering a new offset is discovering a new platform, and since those platforms werent in the derivation “spec” of the needing package, they cannot be relevant. From a capability perspective, we can imagine that the host and target platforms of a package are the capabilities a package requires, and the depending package must provide the capability to the dependency.</p>
<h4 id="variables-specifying-dependencies">Variables specifying dependencies</h4>
<h5 id="var-stdenv-depsBuildBuild"><code>depsBuildBuild</code></h5>
<p>A list of dependencies whose host and target platforms are the new derivations build platform. These are programs and libraries used at build time that produce programs and libraries also used at build time. If the dependency doesnt care about the target platform (i.e. isnt a compiler or similar tool), put it in <code>nativeBuildInputs</code> instead. The most common use of this <code>buildPackages.stdenv.cc</code>, the default C compiler for this role. That example crops up more than one might think in old commonly used C libraries.</p>
<p>Since these packages are able to be run at build-time, they are always added to the <code>PATH</code>, as described above. But since these packages are only guaranteed to be able to run then, they shouldnt persist as run-time dependencies. This isnt currently enforced, but could be in the future.</p>
<h5 id="var-stdenv-nativeBuildInputs"><code>nativeBuildInputs</code></h5>
<p>A list of dependencies whose host platform is the new derivations build platform, and target platform is the new derivations host platform. These are programs and libraries used at build-time that, if they are a compiler or similar tool, produce code to run at run-time—i.e. tools used to build the new derivation. If the dependency doesnt care about the target platform (i.e. isnt a compiler or similar tool), put it here, rather than in <code>depsBuildBuild</code> or <code>depsBuildTarget</code>. This could be called <code>depsBuildHost</code> but <code>nativeBuildInputs</code> is used for historical continuity.</p>
<p>Since these packages are able to be run at build-time, they are added to the <code>PATH</code>, as described above. But since these packages are only guaranteed to be able to run then, they shouldnt persist as run-time dependencies. This isnt currently enforced, but could be in the future.</p>
<h5 id="var-stdenv-depsBuildTarget"><code>depsBuildTarget</code></h5>
<p>A list of dependencies whose host platform is the new derivations build platform, and target platform is the new derivations target platform. These are programs used at build time that produce code to run with code produced by the depending package. Most commonly, these are tools used to build the runtime or standard library that the currently-being-built compiler will inject into any code it compiles. In many cases, the currently-being-built-compiler is itself employed for that task, but when that compiler wont run (i.e. its build and host platform differ) this is not possible. Other times, the compiler relies on some other tool, like binutils, that is always built separately so that the dependency is unconditional.</p>
<p>This is a somewhat confusing concept to wrap ones head around, and for good reason. As the only dependency type where the platform offsets, <code>-1</code> and <code>1</code>, are not adjacent integers, it requires thinking of a bootstrapping stage <em>two</em> away from the current one. It and its use-case go hand in hand and are both considered poor form: try to not need this sort of dependency, and try to avoid building standard libraries and runtimes in the same derivation as the compiler produces code using them. Instead strive to build those like a normal library, using the newly-built compiler just as a normal library would. In short, do not use this attribute unless you are packaging a compiler and are sure it is needed.</p>
<p>Since these packages are able to run at build time, they are added to the <code>PATH</code>, as described above. But since these packages are only guaranteed to be able to run then, they shouldnt persist as run-time dependencies. This isnt currently enforced, but could be in the future.</p>
<h5 id="var-stdenv-depsHostHost"><code>depsHostHost</code></h5>
<p>A list of dependencies whose host and target platforms match the new derivations host platform. In practice, this would usually be tools used by compilers for macros or a metaprogramming system, or libraries used by the macros or metaprogramming code itself. Its always preferable to use a <code>depsBuildBuild</code> dependency in the derivation being built over a <code>depsHostHost</code> on the tool doing the building for this purpose.</p>
<h5 id="var-stdenv-buildInputs"><code>buildInputs</code></h5>
<p>A list of dependencies whose host platform and target platform match the new derivations. This would be called <code>depsHostTarget</code> but for historical continuity. If the dependency doesnt care about the target platform (i.e. isnt a compiler or similar tool), put it here, rather than in <code>depsBuildBuild</code>.</p>
<p>These are often programs and libraries used by the new derivation at <em>run</em>-time, but that isnt always the case. For example, the machine code in a statically-linked library is only used at run-time, but the derivation containing the library is only needed at build-time. Even in the dynamic case, the library may also be needed at build-time to appease the linker.</p>
<h5 id="var-stdenv-depsTargetTarget"><code>depsTargetTarget</code></h5>
<p>A list of dependencies whose host platform matches the new derivations target platform. These are packages that run on the target platform, e.g. the standard library or run-time deps of standard library that a compiler insists on knowing about. Its poor form in almost all cases for a package to depend on another from a future stage [future stage corresponding to positive offset]. Do not use this attribute unless you are packaging a compiler and are sure it is needed.</p>
<h5 id="var-stdenv-depsBuildBuildPropagated"><code>depsBuildBuildPropagated</code></h5>
<p>The propagated equivalent of <code>depsBuildBuild</code>. This perhaps never ought to be used, but it is included for consistency [see below for the others].</p>
<h5 id="var-stdenv-propagatedNativeBuildInputs"><code>propagatedNativeBuildInputs</code></h5>
<p>The propagated equivalent of <code>nativeBuildInputs</code>. This would be called <code>depsBuildHostPropagated</code> but for historical continuity. For example, if package <code>Y</code> has <code>propagatedNativeBuildInputs = [X]</code>, and package <code>Z</code> has <code>buildInputs = [Y]</code>, then package <code>Z</code> will be built as if it included package <code>X</code> in its <code>nativeBuildInputs</code>. If instead, package <code>Z</code> has <code>nativeBuildInputs = [Y]</code>, then <code>Z</code> will be built as if it included <code>X</code> in the <code>depsBuildBuild</code> of package <code>Z</code>, because of the sum of the two <code>-1</code> host offsets.</p>
<h5 id="var-stdenv-depsBuildTargetPropagated"><code>depsBuildTargetPropagated</code></h5>
<p>The propagated equivalent of <code>depsBuildTarget</code>. This is prefixed for the same reason of alerting potential users.</p>
<h5 id="var-stdenv-depsHostHostPropagated"><code>depsHostHostPropagated</code></h5>
<p>The propagated equivalent of <code>depsHostHost</code>.</p>
<h5 id="var-stdenv-propagatedBuildInputs"><code>propagatedBuildInputs</code></h5>
<p>The propagated equivalent of <code>buildInputs</code>. This would be called <code>depsHostTargetPropagated</code> but for historical continuity.</p>
<h5 id="var-stdenv-depsTargetTargetPropagated"><code>depsTargetTargetPropagated</code></h5>
<p>The propagated equivalent of <code>depsTargetTarget</code>. This is prefixed for the same reason of alerting potential users.</p>
<h2 id="ssec-stdenv-attributes">Attributes</h2>
<h3 id="variables-affecting-stdenv-initialisation">Variables affecting <code>stdenv</code> initialisation</h3>
<h4 id="var-stdenv-NIX_DEBUG"><code>NIX_DEBUG</code></h4>
<p>A number between 0 and 7 indicating how much information to log. If set to 1 or higher, <code>stdenv</code> will print moderate debugging information during the build. In particular, the <code>gcc</code> and <code>ld</code> wrapper scripts will print out the complete command line passed to the wrapped tools. If set to 6 or higher, the <code>stdenv</code> setup script will be run with <code>set -x</code> tracing. If set to 7 or higher, the <code>gcc</code> and <code>ld</code> wrapper scripts will also be run with <code>set -x</code> tracing.</p>
<h3 id="attributes-affecting-build-properties">Attributes affecting build properties</h3>
<h4 id="var-stdenv-enableParallelBuilding"><code>enableParallelBuilding</code></h4>
<p>If set to <code>true</code>, <code>stdenv</code> will pass specific flags to <code>make</code> and other build tools to enable parallel building with up to <code>build-cores</code> workers.</p>
<p>Unless set to <code>false</code>, some build systems with good support for parallel building including <code>cmake</code>, <code>meson</code>, and <code>qmake</code> will set it to <code>true</code>.</p>
<h3 id="mkderivation-recursive-attributes">Fixed-point arguments of <code>mkDerivation</code></h3>
<p>If you pass a function to <code>mkDerivation</code>, it will receive as its argument the final arguments, including the overrides when reinvoked via <code>overrideAttrs</code>. For example:</p>
<div class="highlight"><pre><span></span><code>mkDerivation <span class="p">(</span>finalAttrs<span class="p">:</span> <span class="p">{</span>
<span class="ss">pname</span> <span class="o">=</span> <span class="s2">&quot;hello&quot;</span><span class="p">;</span>
<span class="ss">withFeature</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
<span class="ss">configureFlags</span> <span class="o">=</span>
lib<span class="o">.</span>optionals finalAttrs<span class="o">.</span>withFeature <span class="p">[</span><span class="s2">&quot;--with-feature&quot;</span><span class="p">];</span>
<span class="p">})</span>
</code></pre></div>
<p>Note that this does not use the <code>rec</code> keyword to reuse <code>withFeature</code> in <code>configureFlags</code>.
The <code>rec</code> keyword works at the syntax level and is unaware of overriding.</p>
<p>Instead, the definition references <code>finalAttrs</code>, allowing users to change <code>withFeature</code>
consistently with <code>overrideAttrs</code>.</p>
<p><code>finalAttrs</code> also contains the attribute <code>finalPackage</code>, which includes the output paths, etc.</p>
<p>Let's look at a more elaborate example to understand the differences between
various bindings:</p>
<div class="highlight"><pre><span></span><code><span class="c1"># `pkg` is the _original_ definition (for illustration purposes)</span>
<span class="k">let</span> <span class="ss">pkg</span> <span class="o">=</span>
mkDerivation <span class="p">(</span>finalAttrs<span class="p">:</span> <span class="p">{</span>
<span class="c1"># ...</span>
<span class="c1"># An example attribute</span>
<span class="ss">packages</span> <span class="o">=</span> <span class="p">[];</span>
<span class="c1"># `passthru.tests` is a commonly defined attribute.</span>
passthru<span class="o">.</span>tests<span class="o">.</span><span class="ss">simple</span> <span class="o">=</span> f finalAttrs<span class="o">.</span>finalPackage<span class="p">;</span>
<span class="c1"># An example of an attribute containing a function</span>
passthru<span class="o">.</span><span class="ss">appendPackages</span> <span class="o">=</span> packages&#39;<span class="p">:</span>
finalAttrs<span class="o">.</span>finalPackage<span class="o">.</span>overrideAttrs <span class="p">(</span>newSelf<span class="p">:</span> super<span class="p">:</span> <span class="p">{</span>
<span class="ss">packages</span> <span class="o">=</span> super<span class="o">.</span>packages <span class="o">++</span> packages&#39;<span class="p">;</span>
<span class="p">});</span>
<span class="c1"># For illustration purposes; referenced as</span>
<span class="c1"># `(pkg.overrideAttrs(x)).finalAttrs` etc in the text below.</span>
passthru<span class="o">.</span><span class="ss">finalAttrs</span> <span class="o">=</span> finalAttrs<span class="p">;</span>
passthru<span class="o">.</span><span class="ss">original</span> <span class="o">=</span> pkg<span class="p">;</span>
<span class="p">});</span>
<span class="k">in</span> pkg
</code></pre></div>
<p>Unlike the <code>pkg</code> binding in the above example, the <code>finalAttrs</code> parameter always references the final attributes. For instance <code>(pkg.overrideAttrs(x)).finalAttrs.finalPackage</code> is identical to <code>pkg.overrideAttrs(x)</code>, whereas <code>(pkg.overrideAttrs(x)).original</code> is the same as the original <code>pkg</code>.</p>
<p>See also the section about <a href="#var-passthru-tests"><code>passthru.tests</code></a>.</p>
<h2 id="sec-stdenv-phases">Phases</h2>
<p><code>stdenv.mkDerivation</code> sets the Nix <a href="https://nixos.org/manual/nix/stable/expressions/derivations.html#derivations">derivation</a>'s builder to a script that loads the stdenv <code>setup.sh</code> bash library and calls <code>genericBuild</code>. Most packaging functions rely on this default builder.</p>
<p>This generic command either invokes a script at <em>buildCommandPath</em>, or a <em>buildCommand</em>, or a number of <em>phases</em>. Package builds are split into phases to make it easier to override specific parts of the build (e.g., unpacking the sources or installing the binaries).</p>
<p>Each phase can be overridden in its entirety either by setting the environment variable <code>namePhase</code> to a string containing some shell commands to be executed, or by redefining the shell function <code>namePhase</code>. The former is convenient to override a phase from the derivation, while the latter is convenient from a build script. However, typically one only wants to <em>add</em> some commands to a phase, e.g. by defining <code>postInstall</code> or <code>preFixup</code>, as skipping some of the default actions may have unexpected consequences. The default script for each phase is defined in the file <code>pkgs/stdenv/generic/setup.sh</code>.</p>
<p>When overriding a phase, for example <code>installPhase</code>, it is important to start with <code>runHook preInstall</code> and end it with <code>runHook postInstall</code>, otherwise <code>preInstall</code> and <code>postInstall</code> will not be run. Even if you don't use them directly, it is good practice to do so anyways for downstream users who would want to add a <code>postInstall</code> by overriding your derivation.</p>
<p>While inside an interactive <code>nix-shell</code>, if you wanted to run all phases in the order they would be run in an actual build, you can invoke <code>genericBuild</code> yourself.</p>
<h3 id="ssec-controlling-phases">Controlling phases</h3>
<p>There are a number of variables that control what phases are executed and in what order:</p>
<h4 id="variables-affecting-phase-control">Variables affecting phase control</h4>
<h5 id="var-stdenv-phases"><code>phases</code></h5>
<p>Specifies the phases. You can change the order in which phases are executed, or add new phases, by setting this variable. If its not set, the default value is used, which is <code>$prePhases unpackPhase patchPhase $preConfigurePhases configurePhase $preBuildPhases buildPhase checkPhase $preInstallPhases installPhase fixupPhase installCheckPhase $preDistPhases distPhase $postPhases</code>.</p>
<p>It is discouraged to set this variable, as it is easy to miss some important functionality hidden in some of the less obviously needed phases (like <code>fixupPhase</code> which patches the shebang of scripts).
Usually, if you just want to add a few phases, its more convenient to set one of the variables below (such as <code>preInstallPhases</code>).</p>
<h5 id="var-stdenv-prePhases"><code>prePhases</code></h5>
<p>Additional phases executed before any of the default phases.</p>
<h5 id="var-stdenv-preConfigurePhases"><code>preConfigurePhases</code></h5>
<p>Additional phases executed just before the configure phase.</p>
<h5 id="var-stdenv-preBuildPhases"><code>preBuildPhases</code></h5>
<p>Additional phases executed just before the build phase.</p>
<h5 id="var-stdenv-preInstallPhases"><code>preInstallPhases</code></h5>
<p>Additional phases executed just before the install phase.</p>
<h5 id="var-stdenv-preFixupPhases"><code>preFixupPhases</code></h5>
<p>Additional phases executed just before the fixup phase.</p>
<h5 id="var-stdenv-preDistPhases"><code>preDistPhases</code></h5>
<p>Additional phases executed just before the distribution phase.</p>
<h5 id="var-stdenv-postPhases"><code>postPhases</code></h5>
<p>Additional phases executed after any of the default phases.</p>
<h3 id="ssec-unpack-phase">The unpack phase</h3>
<p>The unpack phase is responsible for unpacking the source code of the package. The default implementation of <code>unpackPhase</code> unpacks the source files listed in the <code>src</code> environment variable to the current directory. It supports the following files by default:</p>
<h4 id="tar-files">Tar files</h4>
<p>These can optionally be compressed using <code>gzip</code> (<code>.tar.gz</code>, <code>.tgz</code> or <code>.tar.Z</code>), <code>bzip2</code> (<code>.tar.bz2</code>, <code>.tbz2</code> or <code>.tbz</code>) or <code>xz</code> (<code>.tar.xz</code>, <code>.tar.lzma</code> or <code>.txz</code>).</p>
<h4 id="zip-files">Zip files</h4>
<p>Zip files are unpacked using <code>unzip</code>. However, <code>unzip</code> is not in the standard environment, so you should add it to <code>nativeBuildInputs</code> yourself.</p>
<h4 id="directories-in-the-nix-store">Directories in the Nix store</h4>
<p>These are copied to the current directory. The hash part of the file name is stripped, e.g. <code>/nix/store/1wydxgby13cz...-my-sources</code> would be copied to <code>my-sources</code>.</p>
<p>Additional file types can be supported by setting the <code>unpackCmd</code> variable (see below).</p>
<h4 id="variables-controlling-the-unpack-phase">Variables controlling the unpack phase</h4>
<h5 id="var-stdenv-src"><code>srcs</code> / <code>src</code></h5>
<p>The list of source files or directories to be unpacked or copied. One of these must be set. Note that if you use <code>srcs</code>, you should also set <code>sourceRoot</code> or <code>setSourceRoot</code>.</p>
<h5 id="var-stdenv-sourceRoot"><code>sourceRoot</code></h5>
<p>After unpacking all of <code>src</code> and <code>srcs</code>, if neither of <code>sourceRoot</code> and <code>setSourceRoot</code> are set, <code>unpackPhase</code> of the generic builder checks that the unpacking produced a single directory and moves the current working directory into it.</p>
<p>If <code>unpackPhase</code> produces multiple source directories, you should set <code>sourceRoot</code> to the name of the intended directory.
You can also set <code>sourceRoot = ".";</code> if you want to control it yourself in a later phase.</p>
<p>For example, if your want your build to start in a sub-directory inside your sources, and you are using <code>fetchzip</code>-derived <code>src</code> (like <code>fetchFromGitHub</code> or similar), you need to set <code>sourceRoot = "${src.name}/my-sub-directory"</code>.</p>
<h5 id="var-stdenv-setSourceRoot"><code>setSourceRoot</code></h5>
<p>Alternatively to setting <code>sourceRoot</code>, you can set <code>setSourceRoot</code> to a shell command to be evaluated by the unpack phase after the sources have been unpacked. This command must set <code>sourceRoot</code>.</p>
<p>For example, if you are using <code>fetchurl</code> on an archive file that gets unpacked into a single directory the name of which changes between package versions, and you want your build to start in its sub-directory, you need to set <code>setSourceRoot = "sourceRoot=$(echo */my-sub-directory)";</code>, or in the case of multiple sources, you could use something more specific, like <code>setSourceRoot = "sourceRoot=$(echo ${pname}-*/my-sub-directory)";</code>.</p>
<h5 id="var-stdenv-preUnpack"><code>preUnpack</code></h5>
<p>Hook executed at the start of the unpack phase.</p>
<h5 id="var-stdenv-postUnpack"><code>postUnpack</code></h5>
<p>Hook executed at the end of the unpack phase.</p>
<h5 id="var-stdenv-dontUnpack"><code>dontUnpack</code></h5>
<p>Set to true to skip the unpack phase.</p>
<h5 id="var-stdenv-dontMakeSourcesWritable"><code>dontMakeSourcesWritable</code></h5>
<p>If set to <code>1</code>, the unpacked sources are <em>not</em> made writable. By default, they are made writable to prevent problems with read-only sources. For example, copied store directories would be read-only without this.</p>
<h5 id="var-stdenv-unpackCmd"><code>unpackCmd</code></h5>
<p>The unpack phase evaluates the string <code>$unpackCmd</code> for any unrecognised file. The path to the current source file is contained in the <code>curSrc</code> variable.</p>
<h3 id="ssec-patch-phase">The patch phase</h3>
<p>The patch phase applies the list of patches defined in the <code>patches</code> variable.</p>
<h4 id="variables-controlling-the-patch-phase">Variables controlling the patch phase</h4>
<h5 id="var-stdenv-dontPatch"><code>dontPatch</code></h5>
<p>Set to true to skip the patch phase.</p>
<h5 id="var-stdenv-patches"><code>patches</code></h5>
<p>The list of patches. They must be in the format accepted by the <code>patch</code> command, and may optionally be compressed using <code>gzip</code> (<code>.gz</code>), <code>bzip2</code> (<code>.bz2</code>) or <code>xz</code> (<code>.xz</code>).</p>
<h5 id="var-stdenv-patchFlags"><code>patchFlags</code></h5>
<p>Flags to be passed to <code>patch</code>. If not set, the argument <code>-p1</code> is used, which causes the leading directory component to be stripped from the file names in each patch.</p>
<h5 id="var-stdenv-prePatch"><code>prePatch</code></h5>
<p>Hook executed at the start of the patch phase.</p>
<h5 id="var-stdenv-postPatch"><code>postPatch</code></h5>
<p>Hook executed at the end of the patch phase.</p>
<h3 id="ssec-configure-phase">The configure phase</h3>
<p>The configure phase prepares the source tree for building. The default <code>configurePhase</code> runs <code>./configure</code> (typically an Autoconf-generated script) if it exists.</p>
<h4 id="variables-controlling-the-configure-phase">Variables controlling the configure phase</h4>
<h5 id="var-stdenv-configureScript"><code>configureScript</code></h5>
<p>The name of the configure script. It defaults to <code>./configure</code> if it exists; otherwise, the configure phase is skipped. This can actually be a command (like <code>perl ./Configure.pl</code>).</p>
<h5 id="var-stdenv-configureFlags"><code>configureFlags</code></h5>
<p>A list of strings passed as additional arguments to the configure script.</p>
<h5 id="var-stdenv-dontConfigure"><code>dontConfigure</code></h5>
<p>Set to true to skip the configure phase.</p>
<h5 id="var-stdenv-configureFlagsArray"><code>configureFlagsArray</code></h5>
<p>A shell array containing additional arguments passed to the configure script. You must use this instead of <code>configureFlags</code> if the arguments contain spaces.</p>
<h5 id="var-stdenv-dontAddPrefix"><code>dontAddPrefix</code></h5>
<p>By default, <code>./configure</code> is passed the concatenation of <a href="#var-stdenv-prefixKey"><code>prefixKey</code></a> and <a href="#var-stdenv-prefix"><code>prefix</code></a> on the command line. Disable this by setting <code>dontAddPrefix</code> to <code>true</code>.</p>
<h5 id="var-stdenv-prefix"><code>prefix</code></h5>
<p>The prefix under which the package must be installed, passed via the <code>--prefix</code> option to the configure script. It defaults to <code>$out</code>.</p>
<h5 id="var-stdenv-prefixKey"><code>prefixKey</code></h5>
<p>The key to use when specifying the installation <a href="#var-stdenv-prefix"><code>prefix</code></a>. By default, this is set to <code>--prefix=</code> as that is used by the majority of packages. Other packages may need <code>--prefix</code> (with a trailing space) or <code>PREFIX=</code>.</p>
<h5 id="var-stdenv-dontAddStaticConfigureFlags"><code>dontAddStaticConfigureFlags</code></h5>
<p>By default, when building statically, stdenv will try to add build system appropriate configure flags to try to enable static builds.</p>
<p>If this is undesirable, set this variable to true.</p>
<h5 id="var-stdenv-dontAddDisableDepTrack"><code>dontAddDisableDepTrack</code></h5>
<p>By default, the flag <code>--disable-dependency-tracking</code> is added to the configure flags to speed up Automake-based builds. If this is undesirable, set this variable to true.</p>
<h5 id="var-stdenv-dontFixLibtool"><code>dontFixLibtool</code></h5>
<p>By default, the configure phase applies some special hackery to all files called <code>ltmain.sh</code> before running the configure script in order to improve the purity of Libtool-based packages [^footnote-stdenv-sys-lib-search-path] . If this is undesirable, set this variable to true.</p>
<h5 id="var-stdenv-dontDisableStatic"><code>dontDisableStatic</code></h5>
<p>By default, when the configure script has <code>--enable-static</code>, the option <code>--disable-static</code> is added to the configure flags.</p>
<p>If this is undesirable, set this variable to true. It is automatically set to true when building statically, for example through <code>pkgsStatic</code>.</p>
<h5 id="var-stdenv-configurePlatforms"><code>configurePlatforms</code></h5>
<p>By default, when cross compiling, the configure script has <code>--build=...</code> and <code>--host=...</code> passed. Packages can instead pass <code>[ "build" "host" "target" ]</code> or a subset to control exactly which platform flags are passed. Compilers and other tools can use this to also pass the target platform. [^footnote-stdenv-build-time-guessing-impurity]</p>
<h5 id="var-stdenv-preConfigure"><code>preConfigure</code></h5>
<p>Hook executed at the start of the configure phase.</p>
<h5 id="var-stdenv-postConfigure"><code>postConfigure</code></h5>
<p>Hook executed at the end of the configure phase.</p>
<h3 id="build-phase">The build phase</h3>
<p>The build phase is responsible for actually building the package (e.g. compiling it). The default <code>buildPhase</code> calls <code>make</code> if a file named <code>Makefile</code>, <code>makefile</code> or <code>GNUmakefile</code> exists in the current directory (or the <code>makefile</code> is explicitly set); otherwise it does nothing.</p>
<h4 id="variables-controlling-the-build-phase">Variables controlling the build phase</h4>
<h5 id="var-stdenv-dontBuild"><code>dontBuild</code></h5>
<p>Set to true to skip the build phase.</p>
<h5 id="var-stdenv-makefile"><code>makefile</code></h5>
<p>The file name of the Makefile.</p>
<h5 id="var-stdenv-makeFlags"><code>makeFlags</code></h5>
<p>A list of strings passed as additional flags to <code>make</code>. These flags are also used by the default install and check phase. For setting make flags specific to the build phase, use <code>buildFlags</code> (see below).</p>
<div class="highlight"><pre><span></span><code><span class="p">{</span>
<span class="ss">makeFlags</span> <span class="o">=</span> <span class="p">[</span> <span class="s2">&quot;PREFIX=$(out)&quot;</span> <span class="p">];</span>
<span class="p">}</span>
</code></pre></div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The flags are quoted in bash, but environment variables can be specified by using the make syntax.</p>
</div>
<h5 id="var-stdenv-makeFlagsArray"><code>makeFlagsArray</code></h5>
<p>A shell array containing additional arguments passed to <code>make</code>. You must use this instead of <code>makeFlags</code> if the arguments contain spaces, e.g.</p>
<div class="highlight"><pre><span></span><code><span class="p">{</span>
<span class="ss">preBuild</span> <span class="o">=</span> <span class="s s-Multiline">&#39;&#39;</span>
<span class="s s-Multiline"> makeFlagsArray+=(CFLAGS=&quot;-O0 -g&quot; LDFLAGS=&quot;-lfoo -lbar&quot;)</span>
<span class="s s-Multiline"> &#39;&#39;</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
<p>Note that shell arrays cannot be passed through environment variables, so you cannot set <code>makeFlagsArray</code> in a derivation attribute (because those are passed through environment variables): you have to define them in shell code.</p>
<h5 id="var-stdenv-buildFlags"><code>buildFlags</code> / <code>buildFlagsArray</code></h5>
<p>A list of strings passed as additional flags to <code>make</code>. Like <code>makeFlags</code> and <code>makeFlagsArray</code>, but only used by the build phase. Any build targets should be specified as part of the <code>buildFlags</code>.</p>
<h5 id="var-stdenv-preBuild"><code>preBuild</code></h5>
<p>Hook executed at the start of the build phase.</p>
<h5 id="var-stdenv-postBuild"><code>postBuild</code></h5>
<p>Hook executed at the end of the build phase.</p>
<p>You can set flags for <code>make</code> through the <code>makeFlags</code> variable.</p>
<p>Before and after running <code>make</code>, the hooks <code>preBuild</code> and <code>postBuild</code> are called, respectively.</p>
<h3 id="ssec-check-phase">The check phase</h3>
<p>The check phase checks whether the package was built correctly by running its test suite. The default <code>checkPhase</code> calls <code>make $checkTarget</code>, but only if the <a href="#var-stdenv-doCheck"><code>doCheck</code> variable</a> is enabled.</p>
<p>It is highly recommended, for packages' sources that are not distributed with any tests, to at least use <a href="#versioncheckhook"><code>versionCheckHook</code></a> to test that the resulting executable is basically functional.</p>
<h4 id="variables-controlling-the-check-phase">Variables controlling the check phase</h4>
<h5 id="var-stdenv-doCheck"><code>doCheck</code></h5>
<p>Controls whether the check phase is executed. By default it is skipped, but if <code>doCheck</code> is set to true, the check phase is usually executed. Thus you should set</p>
<div class="highlight"><pre><span></span><code><span class="p">{</span>
<span class="ss">doCheck</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
<p>in the derivation to enable checks. The exception is cross compilation. Cross compiled builds never run tests, no matter how <code>doCheck</code> is set, as the newly-built program wont run on the platform used to build it.</p>
<h5 id="makeflags-makeflagsarray-makefile"><code>makeFlags</code> / <code>makeFlagsArray</code> / <code>makefile</code></h5>
<p>See the <a href="#var-stdenv-makeFlags">build phase</a> for details.</p>
<h5 id="var-stdenv-checkTarget"><code>checkTarget</code></h5>
<p>The <code>make</code> target that runs the tests.
If unset, use <code>check</code> if it exists, otherwise <code>test</code>; if neither is found, do nothing.</p>
<h5 id="var-stdenv-checkFlags"><code>checkFlags</code> / <code>checkFlagsArray</code></h5>
<p>A list of strings passed as additional flags to <code>make</code>. Like <code>makeFlags</code> and <code>makeFlagsArray</code>, but only used by the check phase. Unlike with <code>buildFlags</code>, the <code>checkTarget</code> is automatically added to the <code>make</code> invocation in addition to any <code>checkFlags</code> specified.</p>
<h5 id="var-stdenv-checkInputs"><code>checkInputs</code></h5>
<p>A list of host dependencies used by the phase, usually libraries linked into executables built during tests. This gets included in <code>buildInputs</code> when <code>doCheck</code> is set.</p>
<h5 id="var-stdenv-nativeCheckInputs"><code>nativeCheckInputs</code></h5>
<p>A list of native dependencies used by the phase, notably tools needed on <code>$PATH</code>. This gets included in <code>nativeBuildInputs</code> when <code>doCheck</code> is set.</p>
<h5 id="var-stdenv-preCheck"><code>preCheck</code></h5>
<p>Hook executed at the start of the check phase.</p>
<h5 id="var-stdenv-postCheck"><code>postCheck</code></h5>
<p>Hook executed at the end of the check phase.</p>
<h3 id="ssec-install-phase">The install phase</h3>
<p>The install phase is responsible for installing the package in the Nix store under <code>out</code>. The default <code>installPhase</code> creates the directory <code>$out</code> and calls <code>make install</code>.</p>
<h4 id="variables-controlling-the-install-phase">Variables controlling the install phase</h4>
<h5 id="var-stdenv-dontInstall"><code>dontInstall</code></h5>
<p>Set to true to skip the install phase.</p>
<h5 id="makeflags-makeflagsarray-makefile-1"><code>makeFlags</code> / <code>makeFlagsArray</code> / <code>makefile</code></h5>
<p>See the <a href="#var-stdenv-makeFlags">build phase</a> for details.</p>
<h5 id="var-stdenv-installTargets"><code>installTargets</code></h5>
<p>The make targets that perform the installation. Defaults to <code>install</code>. Example:</p>
<div class="highlight"><pre><span></span><code><span class="p">{</span>
<span class="ss">installTargets</span> <span class="o">=</span> <span class="s2">&quot;install-bin install-doc&quot;</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
<h5 id="var-stdenv-installFlags"><code>installFlags</code> / <code>installFlagsArray</code></h5>
<p>A list of strings passed as additional flags to <code>make</code>. Like <code>makeFlags</code> and <code>makeFlagsArray</code>, but only used by the install phase. Unlike with <code>buildFlags</code>, the <code>installTargets</code> are automatically added to the <code>make</code> invocation in addition to any <code>installFlags</code> specified.</p>
<h5 id="var-stdenv-preInstall"><code>preInstall</code></h5>
<p>Hook executed at the start of the install phase.</p>
<h5 id="var-stdenv-postInstall"><code>postInstall</code></h5>
<p>Hook executed at the end of the install phase.</p>
<h3 id="ssec-fixup-phase">The fixup phase</h3>
<p>The fixup phase performs (Nix-specific) post-processing actions on the files installed under <code>$out</code> by the install phase. The default <code>fixupPhase</code> does the following:</p>
<ul>
<li>It moves the <code>man/</code>, <code>doc/</code> and <code>info/</code> subdirectories of <code>$out</code> to <code>share/</code>.</li>
<li>It strips libraries and executables of debug information.</li>
<li>On Linux, it applies the <code>patchelf</code> command to ELF executables and libraries to remove unused directories from the <code>RPATH</code> in order to prevent unnecessary runtime dependencies.</li>
<li>It rewrites the interpreter paths of shell scripts to paths found in <code>PATH</code>. E.g., <code>/usr/bin/perl</code> will be rewritten to <code>/nix/store/some-perl/bin/perl</code> found in <code>PATH</code>. See <a href="#patch-shebangs.sh"></a> for details.</li>
</ul>
<h4 id="variables-controlling-the-fixup-phase">Variables controlling the fixup phase</h4>
<h5 id="var-stdenv-dontFixup"><code>dontFixup</code></h5>
<p>Set to true to skip the fixup phase.</p>
<h5 id="var-stdenv-dontStrip"><code>dontStrip</code></h5>
<p>If set, libraries and executables are not stripped. By default, they are.</p>
<h5 id="var-stdenv-dontStripHost"><code>dontStripHost</code></h5>
<p>Like <code>dontStrip</code>, but only affects the <code>strip</code> command targeting the packages host platform. Useful when supporting cross compilation, but otherwise feel free to ignore.</p>
<h5 id="var-stdenv-dontStripTarget"><code>dontStripTarget</code></h5>
<p>Like <code>dontStrip</code>, but only affects the <code>strip</code> command targeting the packages target platform. Useful when supporting cross compilation, but otherwise feel free to ignore.</p>
<h5 id="var-stdenv-dontMoveSbin"><code>dontMoveSbin</code></h5>
<p>If set, files in <code>$out/sbin</code> are not moved to <code>$out/bin</code>. By default, they are.</p>
<h5 id="var-stdenv-stripAllList"><code>stripAllList</code></h5>
<p>List of directories to search for libraries and executables from which <em>all</em> symbols should be stripped. By default, its empty. Stripping all symbols is risky, since it may remove not just debug symbols but also ELF information necessary for normal execution.</p>
<h5 id="var-stdenv-stripAllListTarget"><code>stripAllListTarget</code></h5>
<p>Like <code>stripAllList</code>, but only applies to packages target platform. By default, its empty. Useful when supporting cross compilation.</p>
<h5 id="var-stdenv-stripAllFlags"><code>stripAllFlags</code></h5>
<p>Flags passed to the <code>strip</code> command applied to the files in the directories listed in <code>stripAllList</code>. Defaults to <code>-s</code> (i.e. <code>--strip-all</code>).</p>
<h5 id="var-stdenv-stripDebugList"><code>stripDebugList</code></h5>
<p>List of directories to search for libraries and executables from which only debugging-related symbols should be stripped. It defaults to <code>lib lib32 lib64 libexec bin sbin</code>.</p>
<h5 id="var-stdenv-stripDebugListTarget"><code>stripDebugListTarget</code></h5>
<p>Like <code>stripDebugList</code>, but only applies to packages target platform. By default, its empty. Useful when supporting cross compilation.</p>
<h5 id="var-stdenv-stripDebugFlags"><code>stripDebugFlags</code></h5>
<p>Flags passed to the <code>strip</code> command applied to the files in the directories listed in <code>stripDebugList</code>. Defaults to <code>-S</code> (i.e. <code>--strip-debug</code>).</p>
<h5 id="var-stdenv-stripExclude"><code>stripExclude</code></h5>
<p>A list of filenames or path patterns to avoid stripping. A file is excluded if its name <em>or</em> path (from the derivation root) matches.</p>
<p>This example prevents all <code>*.rlib</code> files from being stripped:</p>
<div class="highlight"><pre><span></span><code>stdenv<span class="o">.</span>mkDerivation <span class="p">{</span>
<span class="c1"># ...</span>
<span class="ss">stripExclude</span> <span class="o">=</span> <span class="p">[</span> <span class="s2">&quot;*.rlib&quot;</span> <span class="p">];</span>
<span class="p">}</span>
</code></pre></div>
<p>This example prevents files within certain paths from being stripped:</p>
<div class="highlight"><pre><span></span><code>stdenv<span class="o">.</span>mkDerivation <span class="p">{</span>
<span class="c1"># ...</span>
<span class="ss">stripExclude</span> <span class="o">=</span> <span class="p">[</span> <span class="s2">&quot;lib/modules/*/build/*&quot;</span> <span class="p">];</span>
<span class="p">}</span>
</code></pre></div>
<h5 id="var-stdenv-dontPatchELF"><code>dontPatchELF</code></h5>
<p>If set, the <code>patchelf</code> command is not used to remove unnecessary <code>RPATH</code> entries. Only applies to Linux.</p>
<h5 id="var-stdenv-dontPatchShebangs"><code>dontPatchShebangs</code></h5>
<p>If set, scripts starting with <code>#!</code> do not have their interpreter paths rewritten to paths in the Nix store. See <a href="#patch-shebangs.sh"></a> on how patching shebangs works.</p>
<h5 id="var-stdenv-dontPruneLibtoolFiles"><code>dontPruneLibtoolFiles</code></h5>
<p>If set, libtool <code>.la</code> files associated with shared libraries wont have their <code>dependency_libs</code> field cleared.</p>
<h5 id="var-stdenv-forceShare"><code>forceShare</code></h5>
<p>The list of directories that must be moved from <code>$out</code> to <code>$out/share</code>. Defaults to <code>man doc info</code>.</p>
<h5 id="var-stdenv-setupHook"><code>setupHook</code></h5>
<p>A package can export a <a href="#ssec-setup-hooks">setup hook</a> by setting this variable. The setup hook, if defined, is copied to <code>$out/nix-support/setup-hook</code>. Environment variables are then substituted in it using <code>substituteAll</code>.</p>
<h5 id="var-stdenv-preFixup"><code>preFixup</code></h5>
<p>Hook executed at the start of the fixup phase.</p>
<h5 id="var-stdenv-postFixup"><code>postFixup</code></h5>
<p>Hook executed at the end of the fixup phase.</p>
<h5 id="stdenv-separateDebugInfo"><code>separateDebugInfo</code></h5>
<p>If set to <code>true</code>, the standard environment will enable debug information in C/C++ builds. After installation, the debug information will be separated from the executables and stored in the output named <code>debug</code>. (This output is enabled automatically; you dont need to set the <code>outputs</code> attribute explicitly.) To be precise, the debug information is stored in <code>debug/lib/debug/.build-id/XX/YYYY…</code>, where \&lt;XXYYYY…&gt; is the \&lt;build ID&gt; of the binary — a SHA-1 hash of the contents of the binary. Debuggers like GDB use the build ID to look up the separated debug information.</p>
<div class="admonition example">
<p class="admonition-title">Enable debug symbols for use with GDB</p>
<p>To make GDB find debug information for the <code>socat</code> package and its dependencies, you can use the following <code>shell.nix</code>:</p>
<div class="highlight"><pre><span></span><code><span class="k">let</span>
<span class="ss">pkgs</span> <span class="o">=</span> <span class="nb">import</span> <span class="l">./.</span> <span class="p">{</span>
<span class="ss">config</span> <span class="o">=</span> <span class="p">{};</span>
<span class="ss">overlays</span> <span class="o">=</span> <span class="p">[</span>
<span class="p">(</span>final<span class="p">:</span> prev<span class="p">:</span> <span class="p">{</span>
<span class="ss">ncurses</span> <span class="o">=</span> prev<span class="o">.</span>ncurses<span class="o">.</span>overrideAttrs <span class="p">{</span> <span class="ss">separateDebugInfo</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span> <span class="p">};</span>
<span class="ss">readline</span> <span class="o">=</span> prev<span class="o">.</span>readline<span class="o">.</span>overrideAttrs <span class="p">{</span> <span class="ss">separateDebugInfo</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span> <span class="p">};</span>
<span class="p">})</span>
<span class="p">];</span>
<span class="p">};</span>
<span class="ss">myDebugInfoDirs</span> <span class="o">=</span> pkgs<span class="o">.</span>symlinkJoin <span class="p">{</span>
<span class="ss">name</span> <span class="o">=</span> <span class="s2">&quot;myDebugInfoDirs&quot;</span><span class="p">;</span>
<span class="ss">paths</span> <span class="o">=</span> <span class="k">with</span> pkgs<span class="p">;</span> <span class="p">[</span>
glibc<span class="o">.</span>debug
ncurses<span class="o">.</span>debug
openssl<span class="o">.</span>debug
readline<span class="o">.</span>debug
<span class="p">];</span>
<span class="p">};</span>
<span class="k">in</span>
pkgs<span class="o">.</span>mkShell <span class="p">{</span>
<span class="ss">NIX_DEBUG_INFO_DIRS</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">${</span>pkgs<span class="o">.</span>lib<span class="o">.</span>getLib myDebugInfoDirs<span class="si">}</span><span class="s2">/lib/debug&quot;</span><span class="p">;</span>
<span class="ss">packages</span> <span class="o">=</span> <span class="p">[</span>
pkgs<span class="o">.</span>gdb
pkgs<span class="o">.</span>socat
<span class="p">];</span>
<span class="ss">shellHook</span> <span class="o">=</span> <span class="s s-Multiline">&#39;&#39;</span>
<span class="s s-Multiline"> </span><span class="si">${</span>pkgs<span class="o">.</span>lib<span class="o">.</span>getBin pkgs<span class="o">.</span>gdb<span class="si">}</span><span class="s s-Multiline">/bin/gdb </span><span class="si">${</span>pkgs<span class="o">.</span>lib<span class="o">.</span>getBin pkgs<span class="o">.</span>socat<span class="si">}</span><span class="s s-Multiline">/bin/socat</span>
<span class="s s-Multiline"> &#39;&#39;</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
<p>This setup works as follows:
- Add <a href="#chap-overlays"><code>overlays</code></a> to the package set, since debug symbols are disabled for <code>ncurses</code> and <code>readline</code> by default.
- Create a derivation to combine all required debug symbols under one path with <a href="#trivial-builder-symlinkJoin"><code>symlinkJoin</code></a>.
- Set the environment variable <code>NIX_DEBUG_INFO_DIRS</code> in the shell. Nixpkgs patches <code>gdb</code> to use it for looking up debug symbols.
- Run <code>gdb</code> on the <code>socat</code> binary on shell startup in the <a href="#sec-pkgs-mkShell"><code>shellHook</code></a>. Here we use <a href="#function-library-lib.attrsets.getBin"><code>lib.getBin</code></a> to ensure that the correct derivation output is selected rather than the default one.</p>
</div>
<h3 id="ssec-installCheck-phase">The installCheck phase</h3>
<p>The installCheck phase checks whether the package was installed correctly by running its test suite against the installed directories. The default <code>installCheck</code> calls <code>make installcheck</code>.</p>
<p>It is often better to add tests that are not part of the source distribution to <code>passthru.tests</code> (see
<a href="#var-passthru-tests"></a>). This avoids adding overhead to every build and enables us to run them independently.</p>
<h4 id="variables-controlling-the-installcheck-phase">Variables controlling the installCheck phase</h4>
<h5 id="var-stdenv-doInstallCheck"><code>doInstallCheck</code></h5>
<p>Controls whether the installCheck phase is executed. By default it is skipped, but if <code>doInstallCheck</code> is set to true, the installCheck phase is usually executed. Thus you should set</p>
<div class="highlight"><pre><span></span><code><span class="p">{</span>
<span class="ss">doInstallCheck</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
<p>in the derivation to enable install checks. The exception is cross compilation. Cross compiled builds never run tests, no matter how <code>doInstallCheck</code> is set, as the newly-built program wont run on the platform used to build it.</p>
<h5 id="var-stdenv-installCheckTarget"><code>installCheckTarget</code></h5>
<p>The make target that runs the install tests. Defaults to <code>installcheck</code>.</p>
<h5 id="var-stdenv-installCheckFlags"><code>installCheckFlags</code> / <code>installCheckFlagsArray</code></h5>
<p>A list of strings passed as additional flags to <code>make</code>. Like <code>makeFlags</code> and <code>makeFlagsArray</code>, but only used by the installCheck phase.</p>
<h5 id="var-stdenv-installCheckInputs"><code>installCheckInputs</code></h5>
<p>A list of host dependencies used by the phase, usually libraries linked into executables built during tests. This gets included in <code>buildInputs</code> when <code>doInstallCheck</code> is set.</p>
<h5 id="var-stdenv-nativeInstallCheckInputs"><code>nativeInstallCheckInputs</code></h5>
<p>A list of native dependencies used by the phase, notably tools needed on <code>$PATH</code>. This gets included in <code>nativeBuildInputs</code> when <code>doInstallCheck</code> is set.</p>
<h5 id="var-stdenv-preInstallCheck"><code>preInstallCheck</code></h5>
<p>Hook executed at the start of the installCheck phase.</p>
<h5 id="var-stdenv-postInstallCheck"><code>postInstallCheck</code></h5>
<p>Hook executed at the end of the installCheck phase.</p>
<h3 id="ssec-distribution-phase">The distribution phase</h3>
<p>The distribution phase is intended to produce a source distribution of the package. The default <code>distPhase</code> first calls <code>make dist</code>, then it copies the resulting source tarballs to <code>$out/tarballs/</code>. This phase is only executed if the attribute <code>doDist</code> is set.</p>
<h4 id="variables-controlling-the-distribution-phase">Variables controlling the distribution phase</h4>
<h5 id="var-stdenv-doDist"><code>doDist</code></h5>
<p>If set, the distribution phase is executed.</p>
<h5 id="var-stdenv-distTarget"><code>distTarget</code></h5>
<p>The make target that produces the distribution. Defaults to <code>dist</code>.</p>
<h5 id="var-stdenv-distFlags"><code>distFlags</code> / <code>distFlagsArray</code></h5>
<p>Additional flags passed to <code>make</code>.</p>
<h5 id="var-stdenv-tarballs"><code>tarballs</code></h5>
<p>The names of the source distribution files to be copied to <code>$out/tarballs/</code>. It can contain shell wildcards. The default is <code>*.tar.gz</code>.</p>
<h5 id="var-stdenv-dontCopyDist"><code>dontCopyDist</code></h5>
<p>If set, no files are copied to <code>$out/tarballs/</code>.</p>
<h5 id="var-stdenv-preDist"><code>preDist</code></h5>
<p>Hook executed at the start of the distribution phase.</p>
<h5 id="var-stdenv-postDist"><code>postDist</code></h5>
<p>Hook executed at the end of the distribution phase.</p>
<h2 id="ssec-stdenv-functions">Shell functions and utilities</h2>
<p>The standard environment provides a number of useful functions.</p>
<h3 id="fun-makeWrapper"><code>makeWrapper</code> \&lt;executable&gt; \&lt;wrapperfile&gt; \&lt;args&gt;</h3>
<p>Constructs a wrapper for a program with various possible arguments. It is defined as part of 2 setup-hooks named <code>makeWrapper</code> and <code>makeBinaryWrapper</code> that implement the same bash functions. Hence, to use it you have to add <code>makeWrapper</code> to your <code>nativeBuildInputs</code>. Here's an example usage:</p>
<div class="highlight"><pre><span></span><code><span class="c1"># adds `FOOBAR=baz` to `$out/bin/foo`s environment</span>
makeWrapper<span class="w"> </span><span class="nv">$out</span>/bin/foo<span class="w"> </span><span class="nv">$wrapperfile</span><span class="w"> </span>--set<span class="w"> </span>FOOBAR<span class="w"> </span>baz<span class="w"> </span><span class="s2">&quot;Prefixes the binary paths of `hello` and `git`</span>
<span class="s2"># and suffixes the binary path of `xdg-utils`.</span>
<span class="s2"># Be advised that paths often should be patched in directly</span>
<span class="s2"># (via string replacements or in `configurePhase`).</span>
<span class="s2">makeWrapper </span><span class="nv">$out</span><span class="s2">/bin/foo </span><span class="nv">$wrapperfile</span><span class="s2"> \</span>
<span class="s2"> --prefix PATH : </span><span class="si">${</span><span class="nv">lib</span><span class="p">.makeBinPath [ hello git ]</span><span class="si">}</span><span class="s2"> \</span>
<span class="s2"> --suffix PATH : </span><span class="si">${</span><span class="nv">lib</span><span class="p">.makeBinPath [ xdg-utils ]</span><span class="si">}</span>
</code></pre></div>
<p>Packages may expect or require other utilities to be available at runtime.
<code>makeWrapper</code> can be used to add packages to a <code>PATH</code> environment variable local to a wrapper.</p>
<p>Use <code>--prefix</code> to explicitly set dependencies in <code>PATH</code>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><code>--prefix</code> essentially hard-codes dependencies into the wrapper.
They cannot be overridden without rebuilding the package.</p>
</div>
<p>If dependencies should be resolved at runtime, use <code>--suffix</code> to append fallback values to <code>PATH</code>.</p>
<p>Theres many more kinds of arguments, they are documented in <code>nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh</code> for the <code>makeWrapper</code> implementation and in <code>nixpkgs/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh</code> for the <code>makeBinaryWrapper</code> implementation.</p>
<p><code>wrapProgram</code> is a convenience function you probably want to use most of the time, implemented by both <code>makeWrapper</code> and <code>makeBinaryWrapper</code>.</p>
<p>Using the <code>makeBinaryWrapper</code> implementation is usually preferred, as it creates a tiny <em>compiled</em> wrapper executable, that can be used as a shebang interpreter. This is needed mostly on Darwin, where shebangs cannot point to scripts, <a href="https://stackoverflow.com/questions/67100831/macos-shebang-with-absolute-path-not-working">due to a limitation with the <code>execve</code>-syscall</a>. Compiled wrappers generated by <code>makeBinaryWrapper</code> can be inspected with <code>less &lt;path-to-wrapper&gt;</code> - by scrolling past the binary data you should be able to see the shell command that generated the executable and there see the environment variables that were injected into the wrapper.</p>
<h3 id="fun-remove-references-to"><code>remove-references-to -t</code> \&lt;storepath&gt; [ <code>-t</code> \&lt;storepath&gt; ... ] \&lt;file&gt; ...</h3>
<p>Removes the references of the specified files to the specified store files. This is done without changing the size of the file by replacing the hash by <code>eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee</code>, and should work on compiled executables. This is meant to be used to remove the dependency of the output on inputs that are known to be unnecessary at runtime. Of course, reckless usage will break the patched programs.
To use this, add <code>removeReferencesTo</code> to <code>nativeBuildInputs</code>.</p>
<p>As <code>remove-references-to</code> is an actual executable and not a shell function, it can be used with <code>find</code>.
Example removing all references to the compiler in the output:
<div class="highlight"><pre><span></span><code><span class="p">{</span>
<span class="ss">postInstall</span> <span class="o">=</span> <span class="s s-Multiline">&#39;&#39;</span>
<span class="s s-Multiline"> find &quot;$out&quot; -type f -exec remove-references-to -t </span><span class="si">${</span>stdenv<span class="o">.</span>cc<span class="si">}</span><span class="s s-Multiline"> &#39;{}&#39; +</span>
<span class="s s-Multiline"> &#39;&#39;</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div></p>
<h3 id="fun-substitute"><code>substitute</code> \&lt;infile&gt; \&lt;outfile&gt; \&lt;subs&gt;</h3>
<p>Performs string substitution on the contents of \&lt;infile&gt;, writing the result to \&lt;outfile&gt;. The substitutions in \&lt;subs&gt; are of the following form:</p>
<h4 id="fun-substitute-replace-fail"><code>--replace-fail</code> \&lt;s1&gt; \&lt;s2&gt;</h4>
<p>Replace every occurrence of the string \&lt;s1&gt; by \&lt;s2&gt;.
Will error if no change is made.</p>
<h4 id="fun-substitute-replace-warn"><code>--replace-warn</code> \&lt;s1&gt; \&lt;s2&gt;</h4>
<p>Replace every occurrence of the string \&lt;s1&gt; by \&lt;s2&gt;.
Will print a warning if no change is made.</p>
<h4 id="fun-substitute-replace-quiet"><code>--replace-quiet</code> \&lt;s1&gt; \&lt;s2&gt;</h4>
<p>Replace every occurrence of the string \&lt;s1&gt; by \&lt;s2&gt;.
Will do nothing if no change can be made.</p>
<h4 id="fun-substitute-subst-var"><code>--subst-var</code> \&lt;varName&gt;</h4>
<p>Replace every occurrence of <code>@varName@</code> by the contents of the environment variable \&lt;varName&gt;. This is useful for generating files from templates, using <code>@...@</code> in the template as placeholders.</p>
<h4 id="fun-substitute-subst-var-by"><code>--subst-var-by</code> \&lt;varName&gt; \&lt;s&gt;</h4>
<p>Replace every occurrence of <code>@varName@</code> by the string \&lt;s&gt;.</p>
<p>Example:</p>
<div class="highlight"><pre><span></span><code>substitute<span class="w"> </span>./foo.in<span class="w"> </span>./foo.out<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>--replace-fail<span class="w"> </span>/usr/bin/bar<span class="w"> </span><span class="nv">$bar</span>/bin/bar<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>--replace-fail<span class="w"> </span><span class="s2">&quot;a string containing spaces&quot;</span><span class="w"> </span><span class="s2">&quot;some other text&quot;</span><span class="w"> </span><span class="se">\</span>
<span class="w"> </span>--subst-var<span class="w"> </span>someVar
</code></pre></div>
<h3 id="fun-substituteInPlace"><code>substituteInPlace</code> \&lt;multiple files&gt; \&lt;subs&gt;</h3>
<p>Like <code>substitute</code>, but performs the substitutions in place on the files passed.</p>
<h3 id="fun-substituteAll"><code>substituteAll</code> \&lt;infile&gt; \&lt;outfile&gt;</h3>
<p>Replaces every occurrence of <code>@varName@</code>, where \&lt;varName&gt; is any environment variable, in \&lt;infile&gt;, writing the result to \&lt;outfile&gt;. For instance, if \&lt;infile&gt; has the contents</p>
<div class="highlight"><pre><span></span><code><span class="ch">#! @bash@/bin/sh</span>
<span class="nv">PATH</span><span class="o">=</span>@coreutils@/bin
<span class="nb">echo</span><span class="w"> </span>@foo@
</code></pre></div>
<p>and the environment contains <code>bash=/nix/store/bmwp0q28cf21...-bash-3.2-p39</code> and <code>coreutils=/nix/store/68afga4khv0w...-coreutils-6.12</code>, but does not contain the variable <code>foo</code>, then the output will be</p>
<div class="highlight"><pre><span></span><code><span class="ch">#! /nix/store/bmwp0q28cf21...-bash-3.2-p39/bin/sh</span>
<span class="nv">PATH</span><span class="o">=</span>/nix/store/68afga4khv0w...-coreutils-6.12/bin
<span class="nb">echo</span><span class="w"> </span>@foo@
</code></pre></div>
<p>That is, no substitution is performed for undefined variables.</p>
<p>Environment variables that start with an uppercase letter or an underscore are filtered out, to prevent global variables (like <code>HOME</code>) or private variables (like <code>__ETC_PROFILE_DONE</code>) from accidentally getting substituted. The variables also have to be valid bash "names", as defined in the bash manpage (alphanumeric or <code>_</code>, must not start with a number).</p>
<h3 id="fun-substituteAllInPlace"><code>substituteAllInPlace</code> \&lt;file&gt;</h3>
<p>Like <code>substituteAll</code>, but performs the substitutions in place on the file \&lt;file&gt;.</p>
<h3 id="fun-stripHash"><code>stripHash</code> \&lt;path&gt;</h3>
<p>Strips the directory and hash part of a store path, outputting the name part to <code>stdout</code>. For example:</p>
<div class="highlight"><pre><span></span><code><span class="c1"># prints coreutils-8.24</span>
stripHash<span class="w"> </span><span class="s2">&quot;/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24&quot;</span>
</code></pre></div>
<p>If you wish to store the result in another variable, then the following idiom may be useful:</p>
<div class="highlight"><pre><span></span><code><span class="nv">name</span><span class="o">=</span><span class="s2">&quot;/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24&quot;</span>
<span class="nv">someVar</span><span class="o">=</span><span class="k">$(</span>stripHash<span class="w"> </span><span class="nv">$name</span><span class="k">)</span>
</code></pre></div>
<h3 id="fun-wrapProgram"><code>wrapProgram</code> \&lt;executable&gt; \&lt;makeWrapperArgs&gt;</h3>
<p>Convenience function for <code>makeWrapper</code> that replaces <code>&lt;executable&gt;</code> with a wrapper that executes the original program. It takes all the same arguments as <code>makeWrapper</code>, except for <code>--inherit-argv0</code> (used by the <code>makeBinaryWrapper</code> implementation) and <code>--argv0</code> (used by both <code>makeWrapper</code> and <code>makeBinaryWrapper</code> wrapper implementations).</p>
<p>If you will apply it multiple times, it will overwrite the wrapper file and you will end up with double wrapping, which should be avoided.</p>
<h3 id="fun-prependToVar"><code>prependToVar</code> \&lt;variableName&gt; \&lt;elements...&gt;</h3>
<p>Prepend elements to a variable.</p>
<p>Example:</p>
<div class="highlight"><pre><span></span><code>$ configureFlags=&quot;--disable-static&quot;
$ prependToVar configureFlags --disable-dependency-tracking --enable-foo
$ echo $configureFlags
--disable-dependency-tracking --enable-foo --disable-static
</code></pre></div>
<h3 id="fun-appendToVar"><code>appendToVar</code> \&lt;variableName&gt; \&lt;elements...&gt;</h3>
<p>Append elements to a variable.</p>
<p>Example:</p>
<div class="highlight"><pre><span></span><code>$ configureFlags=&quot;--disable-static&quot;
$ appendToVar configureFlags --disable-dependency-tracking --enable-foo
$ echo $configureFlags
--disable-static --disable-dependency-tracking --enable-foo
</code></pre></div>
<h2 id="ssec-setup-hooks">Package setup hooks</h2>
<p>Nix itself considers a build-time dependency as merely something that should previously be built and accessible at build time—packages themselves are on their own to perform any additional setup. In most cases, that is fine, and the downstream derivation can deal with its own dependencies. But for a few common tasks, that would result in almost every package doing the same sort of setup work—depending not on the package itself, but entirely on which dependencies were used.</p>
<p>In order to alleviate this burden, the setup hook mechanism was written, where any package can include a shell script that [by convention rather than enforcement by Nix], any downstream reverse-dependency will source as part of its build process. That allows the downstream dependency to merely specify its dependencies, and lets those dependencies effectively initialize themselves. No boilerplate mirroring the list of dependencies is needed.</p>
<p>The setup hook mechanism is a bit of a sledgehammer though: a powerful feature with a broad and indiscriminate area of effect. The combination of its power and implicit use may be expedient, but isnt without costs. Nix itself is unchanged, but the spirit of added dependencies being effect-free is violated even if the latter isnt. For example, if a derivation path is mentioned more than once, Nix itself doesnt care and makes sure the dependency derivation is already built just the same—depending is just needing something to exist, and needing is idempotent. However, a dependency specified twice will have its setup hook run twice, and that could easily change the build environment (though a well-written setup hook will therefore strive to be idempotent so this is in fact not observable). More broadly, setup hooks are anti-modular in that multiple dependencies, whether the same or different, should not interfere and yet their setup hooks may well do so.</p>
<p>The most typical use of the setup hook is actually to add other hooks which are then run (i.e. after all the setup hooks) on each dependency. For example, the C compiler wrappers setup hook feeds itself flags for each dependency that contains relevant libraries and headers. This is done by defining a bash function, and appending its name to one of <code>envBuildBuildHooks</code>, <code>envBuildHostHooks</code>, <code>envBuildTargetHooks</code>, <code>envHostHostHooks</code>, <code>envHostTargetHooks</code>, or <code>envTargetTargetHooks</code>. These 6 bash variables correspond to the 6 sorts of dependencies by platform (theres 12 total but we ignore the propagated/non-propagated axis).</p>
<p>Packages adding a hook should not hard code a specific hook, but rather choose a variable <em>relative</em> to how they are included. Returning to the C compiler wrapper example, if the wrapper itself is an <code>n</code> dependency, then it only wants to accumulate flags from <code>n + 1</code> dependencies, as only those ones match the compilers target platform. The <code>hostOffset</code> variable is defined with the current dependencys host offset <code>targetOffset</code> with its target offset, before its setup hook is sourced. Additionally, since most environment hooks dont care about the target platform, that means the setup hook can append to the right bash array by doing something like</p>
<div class="highlight"><pre><span></span><code>addEnvHooks<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$hostOffset</span><span class="s2">&quot;</span><span class="w"> </span>myBashFunction
</code></pre></div>
<p>The <em>existence</em> of setups hooks has long been documented and packages inside Nixpkgs are free to use this mechanism. Other packages, however, should not rely on these mechanisms not changing between Nixpkgs versions. Because of the existing issues with this system, theres little benefit from mandating it be stable for any period of time.</p>
<p>First, lets cover some setup hooks that are part of Nixpkgs default <code>stdenv</code>. This means that they are run for every package built using <code>stdenv.mkDerivation</code> or when using a custom builder that has <code>source $stdenv/setup</code>. Some of these are platform specific, so they may run on Linux but not Darwin or vice-versa.</p>
<h3 id="move-docs.sh"><code>move-docs.sh</code></h3>
<p>This setup hook moves any installed documentation to the <code>/share</code> subdirectory directory. This includes the man, doc and info directories. This is needed for legacy programs that do not know how to use the <code>share</code> subdirectory.</p>
<h3 id="compress-man-pages.sh"><code>compress-man-pages.sh</code></h3>
<p>This setup hook compresses any man pages that have been installed. The compression is done using the gzip program. This helps to reduce the installed size of packages.</p>
<h3 id="strip.sh"><code>strip.sh</code></h3>
<p>This runs the strip command on installed binaries and libraries. This removes unnecessary information like debug symbols when they are not needed. This also helps to reduce the installed size of packages.</p>
<h3 id="patch-shebangs.sh"><code>patch-shebangs.sh</code></h3>
<p>This setup hook patches installed scripts to add Nix store paths to their shebang interpreter as found in the build environment. The <a href="https://en.wikipedia.org/wiki/Shebang_(Unix)">shebang</a> line tells a Unix-like operating system which interpreter to use to execute the script's contents.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The <a href="https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/stdenv/generic/builder.sh">generic builder</a> populates <code>PATH</code> from inputs of the derivation.</p>
</div>
<h4 id="patch-shebangs.sh-invocation">Invocation</h4>
<p>Multiple paths can be specified.</p>
<div class="highlight"><pre><span></span><code>patchShebangs [--build | --host] PATH...
</code></pre></div>
<h5 id="patch-shebangs.sh-invocation-flags">Flags</h5>
<p><code>--build</code>
: Look up commands available at build time</p>
<p><code>--host</code>
: Look up commands available at run time</p>
<h5 id="patch-shebangs.sh-invocation-examples">Examples</h5>
<div class="highlight"><pre><span></span><code>patchShebangs<span class="w"> </span>--host<span class="w"> </span>/nix/store/&lt;hash&gt;-hello-1.0/bin
</code></pre></div>
<div class="highlight"><pre><span></span><code>patchShebangs<span class="w"> </span>--build<span class="w"> </span>configure
</code></pre></div>
<p><code>#!/bin/sh</code> will be rewritten to <code>#!/nix/store/&lt;hash&gt;-some-bash/bin/sh</code>.</p>
<p><code>#!/usr/bin/env</code> gets special treatment: <code>#!/usr/bin/env python</code> is rewritten to <code>/nix/store/&lt;hash&gt;/bin/python</code>.</p>
<p>Interpreter paths that point to a valid Nix store location are not changed.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>A script file must be marked as executable, otherwise it will not be
considered.</p>
</div>
<p>This mechanism ensures that the interpreter for a given script is always found and is exactly the one specified by the build.</p>
<p>It can be disabled by setting <a href="#var-stdenv-dontPatchShebangs"><code>dontPatchShebangs</code></a>:</p>
<div class="highlight"><pre><span></span><code>stdenv<span class="o">.</span>mkDerivation <span class="p">{</span>
<span class="c1"># ...</span>
<span class="ss">dontPatchShebangs</span> <span class="o">=</span> <span class="no">true</span><span class="p">;</span>
<span class="c1"># ...</span>
<span class="p">}</span>
</code></pre></div>
<p>The file <a href="https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/build-support/setup-hooks/patch-shebangs.sh"><code>patch-shebangs.sh</code></a> defines the <a href="https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/build-support/setup-hooks/patch-shebangs.sh#L24-L105"><code>patchShebangs</code></a> function. It is used to implement <a href="https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/build-support/setup-hooks/patch-shebangs.sh#L107-L119"><code>patchShebangsAuto</code></a>, the <a href="#ssec-setup-hooks">setup hook</a> that is registered to run during the <a href="#ssec-fixup-phase">fixup phase</a> by default.</p>
<p>If you need to run <code>patchShebangs</code> at build time, it must be called explicitly within <a href="#sec-stdenv-phases">one of the build phases</a>.</p>
<h3 id="audit-tmpdir.sh"><code>audit-tmpdir.sh</code></h3>
<p>This verifies that no references are left from the install binaries to the directory used to build those binaries. This ensures that the binaries do not need things outside the Nix store. This is currently supported in Linux only.</p>
<h3 id="multiple-outputs.sh"><code>multiple-outputs.sh</code></h3>
<p>This setup hook adds configure flags that tell packages to install files into any one of the proper outputs listed in <code>outputs</code>. This behavior can be turned off by setting <code>setOutputFlags</code> to false in the derivation environment. See <a href="#chap-multiple-output"></a> for more information.</p>
<h3 id="move-sbin.sh"><code>move-sbin.sh</code></h3>
<p>This setup hook moves any binaries installed in the <code>sbin/</code> subdirectory into <code>bin/</code>. In addition, a link is provided from <code>sbin/</code> to <code>bin/</code> for compatibility.</p>
<h3 id="move-lib64.sh"><code>move-lib64.sh</code></h3>
<p>This setup hook moves any libraries installed in the <code>lib64/</code> subdirectory into <code>lib/</code>. In addition, a link is provided from <code>lib64/</code> to <code>lib/</code> for compatibility.</p>
<h3 id="move-systemd-user-units.sh"><code>move-systemd-user-units.sh</code></h3>
<p>This setup hook moves any systemd user units installed in the <code>lib/</code> subdirectory into <code>share/</code>. In addition, a link is provided from <code>share/</code> to <code>lib/</code> for compatibility. This is needed for systemd to find user services when installed into the user profile.</p>
<p>This hook only runs when compiling for Linux.</p>
<h3 id="set-source-date-epoch-to-latest.sh"><code>set-source-date-epoch-to-latest.sh</code></h3>
<p>This sets <code>SOURCE_DATE_EPOCH</code> to the modification time of the most recent file.</p>
<h3 id="bintools-wrapper">Bintools Wrapper and hook</h3>
<p>The Bintools Wrapper wraps the binary utilities for a bunch of miscellaneous purposes. These are GNU Binutils when targeting Linux, and a mix of cctools and GNU binutils for Darwin. [The “Bintools” name is supposed to be a compromise between “Binutils” and “cctools” not denoting any specific implementation.] Specifically, the underlying bintools package, and a C standard library (glibc or Darwins libSystem, just for the dynamic loader) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by the Bintools Wrapper. Packages typically depend on CC Wrapper, which in turn (at run time) depends on the Bintools Wrapper.</p>
<p>The Bintools Wrapper was only just recently split off from CC Wrapper, so the division of labor is still being worked out. For example, it shouldnt care about the C standard library, but just take a derivation with the dynamic loader (which happens to be the glibc on linux). Dependency finding however is a task both wrappers will continue to need to share, and probably the most important to understand. It is currently accomplished by collecting directories of host-platform dependencies (i.e. <code>buildInputs</code> and <code>nativeBuildInputs</code>) in environment variables. The Bintools Wrappers setup hook causes any <code>lib</code> and <code>lib64</code> subdirectories to be added to <code>NIX_LDFLAGS</code>. Since the CC Wrapper and the Bintools Wrapper use the same strategy, most of the Bintools Wrapper code is sparsely commented and refers to the CC Wrapper. But the CC Wrappers code, by contrast, has quite lengthy comments. The Bintools Wrapper merely cites those, rather than repeating them, to avoid falling out of sync.</p>
<p>A final task of the setup hook is defining a number of standard environment variables to tell build systems which executables fulfill which purpose. They are defined to just be the base name of the tools, under the assumption that the Bintools Wrappers binaries will be on the path. Firstly, this helps poorly-written packages, e.g. ones that look for just <code>gcc</code> when <code>CC</code> isnt defined yet <code>clang</code> is to be used. Secondly, this helps packages not get confused when cross-compiling, in which case multiple Bintools Wrappers may simultaneously be in use. [^footnote-stdenv-per-platform-wrapper] <code>BUILD_</code>- and <code>TARGET_</code>-prefixed versions of the normal environment variable are defined for additional Bintools Wrappers, properly disambiguating them.</p>
<p>A problem with this final task is that the Bintools Wrapper is honest and defines <code>LD</code> as <code>ld</code>. Most packages, however, firstly use the C compiler for linking, secondly use <code>LD</code> anyways, defining it as the C compiler, and thirdly, only so define <code>LD</code> when it is undefined as a fallback. This triple-threat means Bintools Wrapper will break those packages, as LD is already defined as the actual linker which the package wont override yet doesnt want to use. The workaround is to define, just for the problematic package, <code>LD</code> as the C compiler. A good way to do this would be <code>preConfigure = "LD=$CC"</code>.</p>
<h3 id="cc-wrapper">CC Wrapper and hook</h3>
<p>The CC Wrapper wraps a C toolchain for a bunch of miscellaneous purposes. Specifically, a C compiler (GCC or Clang), wrapped binary tools, and a C standard library (glibc or Darwins libSystem, just for the dynamic loader) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by the CC Wrapper. Packages typically depend on the CC Wrapper, which in turn (at run-time) depends on the Bintools Wrapper.</p>
<p>Dependency finding is undoubtedly the main task of the CC Wrapper. This works just like the Bintools Wrapper, except that any <code>include</code> subdirectory of any relevant dependency is added to <code>NIX_CFLAGS_COMPILE</code>. The setup hook itself contains elaborate comments describing the exact mechanism by which this is accomplished.</p>
<p>Similarly, the CC Wrapper follows the Bintools Wrapper in defining standard environment variables with the names of the tools it wraps, for the same reasons described above. Importantly, while it includes a <code>cc</code> symlink to the c compiler for portability, the <code>CC</code> will be defined using the compilers “real name” (i.e. <code>gcc</code> or <code>clang</code>). This helps lousy build systems that inspect on the name of the compiler rather than run it.</p>
<p>Here are some more packages that provide a setup hook. Since the list of hooks is extensible, this is not an exhaustive list. The mechanism is only to be used as a last resort, so it might cover most uses.</p>
<h3 id="stdenv-other-hooks">Other hooks</h3>
<p>Many other packages provide hooks, that are not part of <code>stdenv</code>. You can find
these in the <a href="#chap-hooks">Hooks Reference</a>.</p>
<h3 id="compiler-linker-wrapper-hooks">Compiler and Linker wrapper hooks</h3>
<p>If the file <code>${cc}/nix-support/cc-wrapper-hook</code> exists, it will be run at the end of the <a href="#cc-wrapper">compiler wrapper</a>.
If the file <code>${binutils}/nix-support/post-link-hook</code> exists, it will be run at the end of the linker wrapper.
These hooks allow a user to inject code into the wrappers.
As an example, these hooks can be used to extract <code>extraBefore</code>, <code>params</code> and <code>extraAfter</code> which store all the command line arguments passed to the compiler and linker respectively.</p>
<h2 id="sec-purity-in-nixpkgs">Purity in Nixpkgs</h2>
<p><em>Measures taken to prevent dependencies on packages outside the store, and what you can do to prevent them.</em></p>
<p>GCC doesnt search in locations such as <code>/usr/include</code>. In fact, attempts to add such directories through the <code>-I</code> flag are filtered out. Likewise, the linker (from GNU binutils) doesnt search in standard locations such as <code>/usr/lib</code>. Programs built on Linux are linked against a GNU C Library that likewise doesnt search in the default system locations.</p>
<h2 id="sec-hardening-in-nixpkgs">Hardening in Nixpkgs</h2>
<p>There are flags available to harden packages at compile or link-time. These can be toggled using the <code>stdenv.mkDerivation</code> parameters <code>hardeningDisable</code> and <code>hardeningEnable</code>.</p>
<p>Both parameters take a list of flags as strings. The special <code>"all"</code> flag can be passed to <code>hardeningDisable</code> to turn off all hardening. These flags can also be used as environment variables for testing or development purposes.</p>
<p>For more in-depth information on these hardening flags and hardening in general, refer to the <a href="https://wiki.debian.org/Hardening">Debian Wiki</a>, <a href="https://wiki.ubuntu.com/Security/Features">Ubuntu Wiki</a>, <a href="https://wiki.gentoo.org/wiki/Project:Hardened">Gentoo Wiki</a>, and the <a href="https://wiki.archlinux.org/title/Security">Arch Wiki</a>.</p>
<p>Note that support for some hardening flags varies by compiler, CPU architecture, target OS and libc. Combinations of these that don't support a particular hardening flag will silently ignore attempts to enable it. To see exactly which hardening flags are being employed in any invocation, the <code>NIX_DEBUG</code> environment variable can be used.</p>
<h3 id="sec-hardening-flags-enabled-by-default">Hardening flags enabled by default</h3>
<p>The following flags are enabled by default and might require disabling with <code>hardeningDisable</code> if the program to package is incompatible.</p>
<h4 id="format"><code>format</code></h4>
<p>Adds the <code>-Wformat -Wformat-security -Werror=format-security</code> compiler options. At present, this warns about calls to <code>printf</code> and <code>scanf</code> functions where the format string is not a string literal and there are no format arguments, as in <code>printf(foo);</code>. This may be a security hole if the format string came from untrusted input and contains <code>%n</code>.</p>
<p>This needs to be turned off or fixed for errors similar to:</p>
<div class="highlight"><pre><span></span><code>/tmp/nix-build-zynaddsubfx-2.5.2.drv-0/zynaddsubfx-2.5.2/src/UI/guimain.cpp:571:28: error: format not a string literal and no format arguments [-Werror=format-security]
printf(help_message);
^
cc1plus: some warnings being treated as errors
</code></pre></div>
<h4 id="stackprotector"><code>stackprotector</code></h4>
<p>Adds the <code>-fstack-protector-strong --param ssp-buffer-size=4</code> compiler options. This adds safety checks against stack overwrites rendering many potential code injection attacks into aborting situations. In the best case this turns code injection vulnerabilities into denial of service or into non-issues (depending on the application).</p>
<p>This needs to be turned off or fixed for errors similar to:</p>
<div class="highlight"><pre><span></span><code>bin/blib.a(bios_console.o): In function `bios_handle_cup&#39;:
/tmp/nix-build-ipxe-20141124-5cbdc41.drv-0/ipxe-5cbdc41/src/arch/i386/firmware/pcbios/bios_console.c:86: undefined reference to `__stack_chk_fail&#39;
</code></pre></div>
<h4 id="fortify"><code>fortify</code></h4>
<p>Adds the <code>-O2 -D_FORTIFY_SOURCE=2</code> compiler options. During code generation the compiler knows a great deal of information about buffer sizes (where possible), and attempts to replace insecure unlimited length buffer function calls with length-limited ones. This is especially useful for old, crufty code. Additionally, format strings in writable memory that contain <code>%n</code> are blocked. If an application depends on such a format string, it will need to be worked around.</p>
<p>Additionally, some warnings are enabled which might trigger build failures if compiler warnings are treated as errors in the package build. In this case, set <code>env.NIX_CFLAGS_COMPILE</code> to <code>-Wno-error=warning-type</code>.</p>
<p>This needs to be turned off or fixed for errors similar to:</p>
<div class="highlight"><pre><span></span><code>malloc.c:404:15: error: return type is an incomplete type
malloc.c:410:19: error: storage size of &#39;ms&#39; isn&#39;t known
strdup.h:22:1: error: expected identifier or &#39;(&#39; before &#39;__extension__&#39;
strsep.c:65:23: error: register name not specified for &#39;delim&#39;
installwatch.c:3751:5: error: conflicting types for &#39;__open_2&#39;
fcntl2.h:50:4: error: call to &#39;__open_missing_mode&#39; declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
</code></pre></div>
<p>Disabling <code>fortify</code> implies disablement of <code>fortify3</code></p>
<h4 id="fortify3"><code>fortify3</code></h4>
<p>Adds the <code>-O2 -D_FORTIFY_SOURCE=3</code> compiler options. This expands the cases that can be protected by fortify-checks to include some situations with dynamic-length buffers whose length can be inferred at runtime using compiler hints.</p>
<p>Enabling this flag implies enablement of <code>fortify</code>. Disabling this flag does not imply disablement of <code>fortify</code>.</p>
<p>This flag can sometimes conflict with a build-system's own attempts at enabling fortify support and result in errors complaining about <code>redefinition of _FORTIFY_SOURCE</code>.</p>
<h4 id="pic"><code>pic</code></h4>
<p>Adds the <code>-fPIC</code> compiler options. This options adds support for position independent code in shared libraries and thus making ASLR possible.</p>
<p>Most notably, the Linux kernel, kernel modules and other code not running in an operating system environment like boot loaders wont build with PIC enabled. The compiler will is most cases complain that PIC is not supported for a specific build.</p>
<p>This needs to be turned off or fixed for assembler errors similar to:</p>
<div class="highlight"><pre><span></span><code>ccbLfRgg.s: Assembler messages:
ccbLfRgg.s:33: Error: missing or invalid displacement expression `private_key_len@GOTOFF&#39;
</code></pre></div>
<h4 id="strictoverflow"><code>strictoverflow</code></h4>
<p>Signed integer overflow is undefined behaviour according to the C standard. If it happens, it is an error in the program as it should check for overflow before it can happen, not afterwards. GCC provides built-in functions to perform arithmetic with overflow checking, which are correct and faster than any custom implementation. As a workaround, the option <code>-fno-strict-overflow</code> makes gcc behave as if signed integer overflows were defined.</p>
<p>This flag should not trigger any build or runtime errors.</p>
<h4 id="relro"><code>relro</code></h4>
<p>Adds the <code>-z relro</code> linker option. During program load, several ELF memory sections need to be written to by the linker, but can be turned read-only before turning over control to the program. This prevents some GOT (and .dtors) overwrite attacks, but at least the part of the GOT used by the dynamic linker (.got.plt) is still vulnerable.</p>
<p>This flag can break dynamic shared object loading. For instance, the module systems of Xorg and OpenCV are incompatible with this flag. In almost all cases the <code>bindnow</code> flag must also be disabled and incompatible programs typically fail with similar errors at runtime.</p>
<h4 id="bindnow"><code>bindnow</code></h4>
<p>Adds the <code>-z now</code> linker option. During program load, all dynamic symbols are resolved, allowing for the complete GOT to be marked read-only (due to <code>relro</code>). This prevents GOT overwrite attacks. For very large applications, this can incur some performance loss during initial load while symbols are resolved, but this shouldnt be an issue for daemons.</p>
<p>This flag can break dynamic shared object loading. For instance, the module systems of Xorg and PHP are incompatible with this flag. Programs incompatible with this flag often fail at runtime due to missing symbols, like:</p>
<div class="highlight"><pre><span></span><code>intel_drv.so: undefined symbol: vgaHWFreeHWRec
</code></pre></div>
<h4 id="zerocallusedregs"><code>zerocallusedregs</code></h4>
<p>Adds the <code>-fzero-call-used-regs=used-gpr</code> compiler option. This causes the general-purpose registers that an architecture's calling convention considers "call-used" to be zeroed on return from the function. This can make it harder for attackers to construct useful ROP gadgets and also reduces the chance of data leakage from a function call.</p>
<h3 id="sec-hardening-flags-disabled-by-default">Hardening flags disabled by default</h3>
<p>The following flags are disabled by default and should be enabled with <code>hardeningEnable</code> for packages that take untrusted input like network services.</p>
<h4 id="pie"><code>pie</code></h4>
<p>This flag is disabled by default for normal <code>glibc</code> based NixOS package builds, but enabled by default for</p>
<ul>
<li>
<p><code>musl</code>-based package builds, except on Aarch64 and Aarch32, where there are issues.</p>
</li>
<li>
<p>Statically-linked for OpenBSD builds, where it appears to be required to get a working binary.</p>
</li>
</ul>
<p>Adds the <code>-fPIE</code> compiler and <code>-pie</code> linker options. Position Independent Executables are needed to take advantage of Address Space Layout Randomization, supported by modern kernel versions. While ASLR can already be enforced for data areas in the stack and heap (brk and mmap), the code areas must be compiled as position-independent. Shared libraries already do this with the <code>pic</code> flag, so they gain ASLR automatically, but binary .text regions need to be build with <code>pie</code> to gain ASLR. When this happens, ROP attacks are much harder since there are no static locations to bounce off of during a memory corruption attack.</p>
<p>Static libraries need to be compiled with <code>-fPIE</code> so that executables can link them in with the <code>-pie</code> linker option.
If the libraries lack <code>-fPIE</code>, you will get the error <code>recompile with -fPIE</code>.</p>
<h4 id="trivialautovarinit"><code>trivialautovarinit</code></h4>
<p>Adds the <code>-ftrivial-auto-var-init=pattern</code> compiler option. This causes "trivially-initializable" uninitialized stack variables to be forcibly initialized with a nonzero value that is likely to cause a crash (and therefore be noticed). Uninitialized variables generally take on their values based on fragments of previous program state, and attackers can carefully manipulate that state to craft malicious initial values for these variables.</p>
<p>Use of this flag is controversial as it can prevent tools that detect uninitialized variable use (such as valgrind) from operating correctly.</p>
<p>This should be turned off or fixed for build errors such as:</p>
<div class="highlight"><pre><span></span><code>sorry, unimplemented: __builtin_clear_padding not supported for variable length aggregates
</code></pre></div>
<h4 id="stackclashprotection"><code>stackclashprotection</code></h4>
<p>This flag adds the <code>-fstack-clash-protection</code> compiler option, which causes growth of a program's stack to access each successive page in order. This should force the guard page to be accessed and cause an attempt to "jump over" this guard page to crash.</p>
<p>[^footnote-stdenv-ignored-build-platform]: The build platform is ignored because it is a mere implementation detail of the package satisfying the dependency: As a general programming principle, dependencies are always <em>specified</em> as interfaces, not concrete implementation.
[^footnote-stdenv-native-dependencies-in-path]: Currently, this means for native builds all dependencies are put on the <code>PATH</code>. But in the future that may not be the case for sake of matching cross: the platforms would be assumed to be unique for native and cross builds alike, so only the <code>depsBuild*</code> and <code>nativeBuildInputs</code> would be added to the <code>PATH</code>.
[^footnote-stdenv-propagated-dependencies]: Nix itself already takes a packages transitive dependencies into account, but this propagation ensures nixpkgs-specific infrastructure like <a href="#ssec-setup-hooks">setup hooks</a> also are run as if it were a propagated dependency.
[^footnote-stdenv-find-inputs-location]: The <code>findInputs</code> function, currently residing in <code>pkgs/stdenv/generic/setup.sh</code>, implements the propagation logic.
[^footnote-stdenv-sys-lib-search-path]: It clears the <code>sys_lib_*search_path</code> variables in the Libtool script to prevent Libtool from using libraries in <code>/usr/lib</code> and such.
[^footnote-stdenv-build-time-guessing-impurity]: Eventually these will be passed building natively as well, to improve determinism: build-time guessing, as is done today, is a risk of impurity.
[^footnote-stdenv-per-platform-wrapper]: Each wrapper targets a single platform, so if binaries for multiple platforms are needed, the underlying binaries must be wrapped multiple times. As this is a property of the wrapper itself, the multiple wrappings are needed whether or not the same underlying binaries can target multiple platforms.</p>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
<div class="md-copyright__highlight">
Licenced MIT
</div>
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
<div class="md-social">
<a href="https://git.auxolotl.org/auxolotl/docs" target="_blank" rel="noopener" title="Aux Docs Repo" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.777 0a2.9 2.9 0 1 1-2.529 4.322H12.91a4.266 4.266 0 0 0-4.265 4.195v2.118a7.076 7.076 0 0 1 4.147-1.42l.118-.002h1.338a2.9 2.9 0 0 1 5.43 1.422 2.9 2.9 0 0 1-5.43 1.422H12.91a4.266 4.266 0 0 0-4.265 4.195v2.319A2.9 2.9 0 0 1 7.222 24 2.9 2.9 0 0 1 5.8 18.57V8.589a7.109 7.109 0 0 1 6.991-7.108l.118-.001h1.338A2.9 2.9 0 0 1 16.778 0ZM7.223 19.905a1.194 1.194 0 1 0 0 2.389 1.194 1.194 0 0 0 0-2.389Zm9.554-10.464a1.194 1.194 0 1 0 0 2.389 1.194 1.194 0 0 0 0-2.39Zm0-7.735a1.194 1.194 0 1 0 0 2.389 1.194 1.194 0 0 0 0-2.389Z"/></svg>
</a>
<a href="https://forum.aux.computer/" target="_blank" rel="noopener" title="Aux Forum" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.103 0C18.666 0 24 5.485 24 11.997c0 6.51-5.33 11.99-11.9 11.99L0 24V11.79C0 5.28 5.532 0 12.103 0zm.116 4.563a7.395 7.395 0 0 0-6.337 3.57 7.247 7.247 0 0 0-.148 7.22L4.4 19.61l4.794-1.074a7.424 7.424 0 0 0 8.136-1.39 7.256 7.256 0 0 0 1.737-7.997 7.375 7.375 0 0 0-6.84-4.585h-.008z"/></svg>
</a>
<a href="https://wiki.auxolotl.org/" target="_blank" rel="noopener" title="Aux Wiki" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.801 13.557c.148.098.288.202.417.313 1.854 1.6 3.127 4.656 2.582 7.311-1.091-.255-5.747-1.055-7.638-3.383-.91-1.12-1.366-2.081-1.569-2.885a5.65 5.65 0 0 0 .034-.219c.089.198.197.35.313.466.24.24.521.335.766.372.304.046.594-.006.806-.068l.001.001c.05-.015.433-.116.86-.342.325-.173 2.008-.931 3.428-1.566Zm-7.384 1.435C9.156 16.597 6.6 18.939.614 18.417c.219-1.492 1.31-3.019 2.51-4.11.379-.345.906-.692 1.506-1.009.286.168.598.332.939.486 2.689 1.221 3.903 1.001 4.89.573a1.3 1.3 0 0 0 .054-.025 6.156 6.156 0 0 0-.096.66Zm4.152-.462c.38-.341.877-.916 1.383-1.559-.389-.15-.866-.371-1.319-.591-.598-.29-1.305-.283-2.073-.315a4.685 4.685 0 0 1-.804-.103c.014-.123.027-.246.038-.369.062.104.673.057.871.057.354 0 1.621.034 3.074-.574 1.452-.608 2.55-1.706 3.022-3.225.474-1.52.22-3.091-.168-3.952-.169.709-1.453 2.381-1.926 2.871-.473.489-2.381 2.296-2.972 2.921-.7.74-.688.793-1.332 1.302-.202.19-.499.402-.563.53.027-.338.039-.675.027-.997a7.653 7.653 0 0 0-.032-.523c.322-.059.567-.522.567-.861 0-.224-.106-.247-.271-.229.075-.894.382-3.923 1.254-4.281.218.109.831.068.649-.295-.182-.364-.825-.074-1.081.266-.28.374-.956 2.046-.92 4.324-.113.014-.174.033-.322.033-.171 0-.321-.04-.433-.05.034-2.275-.714-3.772-.84-4.169-.12-.375-.491-.596-.781-.596-.146 0-.272.056-.333.179-.182.363.459.417.677.308.706.321 1.156 3.519 1.254 4.277-.125-.006-.199.035-.199.233 0 .311.17.756.452.843a.442.442 0 0 0-.007.03s-.287.99-.413 2.189a4.665 4.665 0 0 1-.718-.225c-.714-.286-1.355-.583-2.019-.566-.664.018-1.366.023-1.804-.036-.438-.058-.649-.15-.649-.15s-.234.365.257 1.075c.42.607 1.055 1.047 1.644 1.18.589.134 1.972.18 2.785-.377.16-.109.317-.228.459-.34a8.717 8.717 0 0 0-.013.626c-.289.753-.571 1.993-.268 3.338 0-.001.701-.842.787-2.958.006-.144.009-.271.01-.383.052-.248.103-.518.148-.799.072.135.151.277.234.413.511.842 1.791 1.37 2.383 1.49.091.019.187.032.285.038Zm-1.12.745c-.188.055-.445.1-.713.059-.21-.031-.45-.11-.655-.316-.169-.168-.312-.419-.401-.789a9.837 9.837 0 0 0 .039-.82l.049-.243c.563.855 1.865 1.398 2.476 1.522.036.008.072.014.109.02l-.013.009c-.579.415-.76.503-.891.558Zm6.333-2.818c-.257.114-4.111 1.822-5.246 2.363.98-.775 3.017-3.59 3.699-4.774 1.062.661 1.468 1.109 1.623 1.441.101.217.09.38.096.515a.57.57 0 0 1-.172.455Zm-9.213 1.62a1.606 1.606 0 0 1-.19.096c-.954.414-2.126.61-4.728-.571-2.023-.918-3.024-2.157-3.371-2.666.476.161 1.471.473 2.157.524.282.021.703.068 1.167.125.021.209.109.486.345.829l.001.001c.451.651 1.134 1.119 1.765 1.262.622.141 2.083.182 2.942-.407a3.12 3.12 0 0 0 .132-.093l.001.179a6.052 6.052 0 0 0-.221.721Zm5.512-1.271a17.49 17.49 0 0 1-1.326-.589c.437.042 1.054.083 1.692.108-.121.162-.244.323-.366.481Zm.932-1.26c-.12.17-.245.343-.373.517-.241.018-.478.03-.709.038a29.05 29.05 0 0 1-.741-.048c.608-.065 1.228-.252 1.823-.507Zm.22-.315c-.809.382-1.679.648-2.507.648-.472 0-.833.018-1.139.039v.001c-.324-.031-.665-.039-1.019-.054a3.555 3.555 0 0 1-.152-.009c.102-.002.192-.006.249-.006.363 0 1.662.034 3.151-.589 1.508-.632 2.645-1.773 3.136-3.351.37-1.186.31-2.402.086-3.312.458-.336.86-.651 1.147-.91.501-.451.743-.733.848-.869.199.206.714.864.685 2.138-.036 1.611-.606 3.187-1.501 4.154a9.099 9.099 0 0 1-1.321 1.132 11.978 11.978 0 0 0-.644-.422l-.089-.055-.051.091c-.184.332-.5.825-.879 1.374ZM4.763 5.817c-.157 1.144.113 2.323.652 3.099.539.776 2.088 2.29 3.614 2.505.991.14 2.055.134 2.055.134s-.593-.576-1.114-1.66c-.521-1.085-.948-2.104-1.734-2.786-.785-.681-1.601-1.416-2.045-1.945-.444-.53-.59-.86-.59-.86s-.656.175-.838 1.513Zm14.301 4.549a9.162 9.162 0 0 0 1.3-1.12c.326-.352.611-.782.845-1.265 1.315.145 2.399.371 2.791.434 0 0-.679 1.971-3.945 3.022l-.016-.035c-.121-.26-.385-.594-.975-1.036Zm-11.634.859a8.537 8.537 0 0 1-.598-.224c-1.657-.693-2.91-1.944-3.449-3.678-.498-1.601-.292-3.251.091-4.269.225.544.758 1.34 1.262 2.01a3.58 3.58 0 0 0-.172.726c-.163 1.197.123 2.428.687 3.24.416.599 1.417 1.62 2.555 2.193-.128.002-.253.003-.376.002Zm-1.758-.077c-.958-.341-1.901-.787-2.697-1.368C-.07 7.559 0 6.827 0 6.827s1.558-.005 3.088.179c.03.126.065.
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "../../..", "features": ["content.tooltips", "search.highlight", "navigation.tabs", "navigation.indexes", "navigation.prune"], "search": "../../../assets/javascripts/workers/search.b8dbb3d2.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script src="../../../assets/javascripts/bundle.fe8b6f2b.min.js"></script>
</body>
</html>