docs/Lix/Command-Reference/nix-env/delete-generations/index.html

3356 lines
76 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/Lix/Command-Reference/nix-env/delete-generations/">
<link rel="prev" href="../">
<link rel="next" href="../install/">
<link rel="icon" href="../../../../assets/aux-logo.svg">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.29">
<title>nix-env --delete-generations - 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="`nix-env --delete-generations` - Aux Docs" >
<meta property="og:description" content="Aux Documentation" >
<meta property="og:image" content="https://docs.auxolotl.org/assets/images/social/Lix/Command-Reference/nix-env/delete-generations.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/Lix/Command-Reference/nix-env/delete-generations/" >
<meta name="twitter:card" content="summary_large_image" >
<meta name="twitter:title" content="`nix-env --delete-generations` - Aux Docs" >
<meta name="twitter:description" content="Aux Documentation" >
<meta name="twitter:image" content="https://docs.auxolotl.org/assets/images/social/Lix/Command-Reference/nix-env/delete-generations.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="#nix-env-delete-generations" 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">
nix-env --delete-generations
</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 md-tabs__item--active">
<a href="../../../" 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">
<a href="../../../../Nixpkgs/" 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--active md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4" checked>
<div class="md-nav__link md-nav__container">
<a href="../../../" class="md-nav__link ">
<span class="md-ellipsis">
Lix
</span>
</a>
<label class="md-nav__link " for="__nav_4" id="__nav_4_label" tabindex="">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_4">
<span class="md-nav__icon md-icon"></span>
Lix
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../glossary/" class="md-nav__link">
<span class="md-ellipsis">
Glossary
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../quick-start/" class="md-nav__link">
<span class="md-ellipsis">
Quick Start
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../../Advanced-Topics/" class="md-nav__link">
<span class="md-ellipsis">
Advanced Topics
</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_4_5" checked>
<div class="md-nav__link md-nav__container">
<a href="../../" class="md-nav__link ">
<span class="md-ellipsis">
Command Reference
</span>
</a>
<label class="md-nav__link " for="__nav_4_5" id="__nav_4_5_label" tabindex="0">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_4_5_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_4_5">
<span class="md-nav__icon md-icon"></span>
Command Reference
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../conf-file/" class="md-nav__link">
<span class="md-ellipsis">
nix.conf
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../env-common/" class="md-nav__link">
<span class="md-ellipsis">
Common Environment Variables
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../experimental-commands/" class="md-nav__link">
<span class="md-ellipsis">
Experimental Commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../main-commands/" class="md-nav__link">
<span class="md-ellipsis">
Main Commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../nix-build/" class="md-nav__link">
<span class="md-ellipsis">
nix-build
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../nix-channel/" class="md-nav__link">
<span class="md-ellipsis">
nix-channel
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../nix-collect-garbage/" class="md-nav__link">
<span class="md-ellipsis">
nix-collect-garbage
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../nix-copy-closure/" class="md-nav__link">
<span class="md-ellipsis">
nix-copy-closure
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../nix-daemon/" class="md-nav__link">
<span class="md-ellipsis">
nix-daemon
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../nix-hash/" class="md-nav__link">
<span class="md-ellipsis">
nix-hash
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../nix-instantiate/" class="md-nav__link">
<span class="md-ellipsis">
nix-instantiate
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../nix-prefetch-url/" class="md-nav__link">
<span class="md-ellipsis">
nix-prefetch-url
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../nix-shell/" class="md-nav__link">
<span class="md-ellipsis">
nix-shell
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../opt-common/" class="md-nav__link">
<span class="md-ellipsis">
Common Options
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../utilities/" class="md-nav__link">
<span class="md-ellipsis">
Utilities
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../New-CLI/nix/" class="md-nav__link">
<span class="md-ellipsis">
New CLI
</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="../../files/" class="md-nav__link">
<span class="md-ellipsis">
Files
</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_4_5_19" checked>
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<span class="md-ellipsis">
Nix env
</span>
</a>
<label class="md-nav__link " for="__nav_4_5_19" id="__nav_4_5_19_label" tabindex="0">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="3" aria-labelledby="__nav_4_5_19_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_4_5_19">
<span class="md-nav__icon md-icon"></span>
Nix env
</label>
<ul class="md-nav__list" data-md-scrollfix>
<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">
nix-env --delete-generations
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
nix-env --delete-generations
</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="#synopsis" class="md-nav__link">
<span class="md-ellipsis">
Synopsis
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#description" class="md-nav__link">
<span class="md-ellipsis">
Description
</span>
</a>
</li>
<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">
<a href="#common-options" class="md-nav__link">
<span class="md-ellipsis">
Common Options
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#environment-variables" class="md-nav__link">
<span class="md-ellipsis">
Environment variables
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#common-environment-variables" class="md-nav__link">
<span class="md-ellipsis">
Common Environment Variables
</span>
</a>
<nav class="md-nav" aria-label="Common Environment Variables">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#xdg-base-directories" class="md-nav__link">
<span class="md-ellipsis">
XDG Base Directories
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#examples" class="md-nav__link">
<span class="md-ellipsis">
Examples
</span>
</a>
<nav class="md-nav" aria-label="Examples">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#delete-explicit-generation-numbers" class="md-nav__link">
<span class="md-ellipsis">
Delete explicit generation numbers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#keep-most-recent-by-count-number-of-generations" class="md-nav__link">
<span class="md-ellipsis">
Keep most-recent by count (number of generations)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#keep-most-recent-by-time-number-of-days" class="md-nav__link">
<span class="md-ellipsis">
Keep most-recent by time (number of days)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#delete-all-older" class="md-nav__link">
<span class="md-ellipsis">
Delete all older
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../install/" class="md-nav__link">
<span class="md-ellipsis">
nix-env --install
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../list-generations/" class="md-nav__link">
<span class="md-ellipsis">
nix-env --list-generations
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../query/" class="md-nav__link">
<span class="md-ellipsis">
nix-env --query
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../rollback/" class="md-nav__link">
<span class="md-ellipsis">
nix-env --rollback
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../set-flag/" class="md-nav__link">
<span class="md-ellipsis">
nix-env --set-flag
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../set/" class="md-nav__link">
<span class="md-ellipsis">
nix-env --set
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../switch-generation/" class="md-nav__link">
<span class="md-ellipsis">
nix-env --switch-generation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../switch-profile/" class="md-nav__link">
<span class="md-ellipsis">
nix-env --switch-profile
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../uninstall/" class="md-nav__link">
<span class="md-ellipsis">
nix-env --uninstall
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../upgrade/" class="md-nav__link">
<span class="md-ellipsis">
nix-env --upgrade
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../nix-store/" class="md-nav__link">
<span class="md-ellipsis">
Nix store
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--pruned md-nav__item--nested">
<a href="../../../Package-Management/" class="md-nav__link">
<span class="md-ellipsis">
Package Management
</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="../../../architecture/" class="md-nav__link">
<span class="md-ellipsis">
Architecture
</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="../../../contributing/" class="md-nav__link">
<span class="md-ellipsis">
Contributing
</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="../../../installation/" class="md-nav__link">
<span class="md-ellipsis">
Installation
</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="../../../language/" class="md-nav__link">
<span class="md-ellipsis">
Language
</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="../../../protocols/" class="md-nav__link">
<span class="md-ellipsis">
Protocols
</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="../../../release-notes/" class="md-nav__link">
<span class="md-ellipsis">
Release notes
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</li>
</ul>
</nav>
</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--pruned md-nav__item--nested">
<a href="../../../../Nixpkgs/" class="md-nav__link">
<span class="md-ellipsis">
Nixpkgs
</span>
<span class="md-nav__icon md-icon"></span>
</a>
</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="#synopsis" class="md-nav__link">
<span class="md-ellipsis">
Synopsis
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#description" class="md-nav__link">
<span class="md-ellipsis">
Description
</span>
</a>
</li>
<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">
<a href="#common-options" class="md-nav__link">
<span class="md-ellipsis">
Common Options
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#environment-variables" class="md-nav__link">
<span class="md-ellipsis">
Environment variables
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#common-environment-variables" class="md-nav__link">
<span class="md-ellipsis">
Common Environment Variables
</span>
</a>
<nav class="md-nav" aria-label="Common Environment Variables">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#xdg-base-directories" class="md-nav__link">
<span class="md-ellipsis">
XDG Base Directories
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#examples" class="md-nav__link">
<span class="md-ellipsis">
Examples
</span>
</a>
<nav class="md-nav" aria-label="Examples">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#delete-explicit-generation-numbers" class="md-nav__link">
<span class="md-ellipsis">
Delete explicit generation numbers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#keep-most-recent-by-count-number-of-generations" class="md-nav__link">
<span class="md-ellipsis">
Keep most-recent by count (number of generations)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#keep-most-recent-by-time-number-of-days" class="md-nav__link">
<span class="md-ellipsis">
Keep most-recent by time (number of days)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#delete-all-older" class="md-nav__link">
<span class="md-ellipsis">
Delete all older
</span>
</a>
</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="nix-env-delete-generations"><code>nix-env --delete-generations</code></h1>
<p>Delete profile generations.</p>
<h2 id="synopsis">Synopsis</h2>
<p><code>nix-env</code> <code>--delete-generations</code> <em>generations</em></p>
<h2 id="description">Description</h2>
<p>This operation deletes the specified generations of the current profile.</p>
<p><em>generations</em> can be a one of the following:</p>
<ul>
<li><span id="generations-list"><code>&lt;number&gt;...</code></span>:
A list of generation numbers, each one a separate command-line argument.</li>
</ul>
<p>Delete exactly the profile generations given by their generation number.
Deleting the current generation is not allowed.</p>
<ul>
<li>The special value <span id="generations-old"><code>old</code></span></li>
</ul>
<p>Delete all generations except the current one.</p>
<blockquote>
<p><strong>WARNING</strong></p>
<p>Older <em>and newer</em> generations will be deleted by this operation.</p>
<p>One might expect this to just delete older generations than the curent one, but that is only true if the current generation is also the latest.
Because one can roll back to a previous generation, it is possible to have generations newer than the current one.
They will also be deleted.</p>
</blockquote>
<ul>
<li><span id="generations-time"><code>&lt;number&gt;d</code></span>:
The last <em>number</em> days</li>
</ul>
<p><em>Example</em>: <code>30d</code></p>
<p>Delete all generations created more than <em>number</em> days ago, except the most recent one of them.
This allows rolling back to generations that were available within the specified period.</p>
<ul>
<li><span id="generations-count"><code>+&lt;number&gt;</code></span>:
The last <em>number</em> generations up to the present</li>
</ul>
<p><em>Example</em>: <code>+5</code></p>
<p>Keep the last <em>number</em> generations, along with any newer than current.</p>
<p>Periodically deleting old generations is important to make garbage collection
effective.
The is because profiles are also garbage collection roots — any <a href="../../../glossary/#gloss-store-object">store object</a> reachable from a profile is "alive" and ineligible for deletion.</p>
<h2 id="options">Options</h2>
<p>The following options are allowed for all <code>nix-env</code> operations, but may not always have an effect.</p>
<ul>
<li>
<p><code>--file</code> / <code>-f</code> <em>path</em>
Specifies the Nix expression (designated below as the <em>active Nix
expression</em>) used by the <code>--install</code>, <code>--upgrade</code>, and <code>--query
--available</code> operations to obtain derivations. The default is
<code>~/.nix-defexpr</code>.</p>
<p>If the argument starts with <code>http://</code> or <code>https://</code>, it is
interpreted as the URL of a tarball that will be downloaded and
unpacked to a temporary location. The tarball must include a single
top-level directory containing at least a file named <code>default.nix</code>.</p>
</li>
<li>
<p><code>--profile</code> / <code>-p</code> <em>path</em>
Specifies the profile to be used by those operations that operate on
a profile (designated below as the <em>active profile</em>). A profile is a
sequence of user environments called <em>generations</em>, one of which is
the <em>current generation</em>.</p>
</li>
<li>
<p><code>--dry-run</code>
For the <code>--install</code>, <code>--upgrade</code>, <code>--uninstall</code>,
<code>--switch-generation</code>, <code>--delete-generations</code> and <code>--rollback</code>
operations, this flag will cause <code>nix-env</code> to print what <em>would</em> be
done if this flag had not been specified, without actually doing it.</p>
<p><code>--dry-run</code> also prints out which paths will be
<a href="../../../glossary/">substituted</a> (i.e., downloaded) and which paths
will be built from source (because no substitute is available).</p>
</li>
<li>
<p><code>--system-filter</code> <em>system</em>
By default, operations such as <code>--query
--available</code> show derivations matching any platform. This option
allows you to use derivations for the specified platform <em>system</em>.</p>
</li>
</ul>
<h2 id="common-options">Common Options</h2>
<p>Most commands in Lix accept the following command-line options:</p>
<ul>
<li><span id="opt-help"><a href="#opt-help"><code>--help</code></a></span></li>
</ul>
<p>Prints out a summary of the command syntax and exits.</p>
<ul>
<li><span id="opt-version"><a href="#opt-version"><code>--version</code></a></span></li>
</ul>
<p>Prints out the Lix version number on standard output and exits.</p>
<ul>
<li><span id="opt-verbose"><a href="#opt-verbose"><code>--verbose</code></a></span> / <code>-v</code></li>
</ul>
<p>Increases the level of verbosity of diagnostic messages printed on standard error.
For each Lix operation, the information printed on standard output is well-defined;
any diagnostic information is printed on standard error, never on standard output.</p>
<p>This option may be specified repeatedly.
Currently, the following verbosity levels exist:</p>
<ul>
<li>
<p><code>0</code> “Errors only”</p>
<p>Only print messages explaining why the Lix invocation failed.</p>
</li>
<li>
<p><code>1</code> “Informational”</p>
<p>Print <em>useful</em> messages about what Lix is doing.
This is the default.</p>
</li>
<li>
<p><code>2</code> “Talkative”</p>
<p>Print more informational messages.</p>
</li>
<li>
<p><code>3</code> “Chatty”</p>
<p>Print even more informational messages.</p>
</li>
<li>
<p><code>4</code> “Debug”</p>
<p>Print debug information.</p>
</li>
<li>
<p><code>5</code> “Vomit”</p>
<p>Print vast amounts of debug information.</p>
</li>
<li>
<p><span id="opt-quiet"><a href="#opt-quiet"><code>--quiet</code></a></span></p>
</li>
</ul>
<p>Decreases the level of verbosity of diagnostic messages printed on standard error.
This is the inverse option to <code>-v</code> / <code>--verbose</code>.</p>
<p>This option may be specified repeatedly.
See the previous verbosity levels list.</p>
<ul>
<li><span id="opt-log-format"><a href="#opt-log-format"><code>--log-format</code></a></span> <em>format</em></li>
</ul>
<p>This option can be used to change the output of the log format, with <em>format</em> being one of:</p>
<ul>
<li>
<p><code>raw</code></p>
<p>This is the raw format, as outputted by nix-build.</p>
</li>
<li>
<p><code>internal-json</code></p>
<p>Outputs the logs in a structured manner.</p>
</li>
</ul>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>While the schema itself is relatively stable, the format of
the error-messages (namely of the <code>msg</code>-field) can change
between releases.</p>
</div>
<ul>
<li>
<p><code>bar</code></p>
<p>Only display a progress bar during the builds.</p>
</li>
<li>
<p><code>bar-with-logs</code></p>
<p>Display the raw logs, with the progress bar at the bottom.</p>
</li>
<li>
<p><span id="opt-no-build-output"><a href="#opt-no-build-output"><code>--no-build-output</code></a></span> / <code>-Q</code></p>
</li>
</ul>
<p>By default, output written by builders to standard output and standard error is echoed to the Lix command's standard error.
This option suppresses this behaviour.
Note that the builder's standard output and error are always written to a log file in <code>prefix/nix/var/log/nix</code>.</p>
<ul>
<li><span id="opt-max-jobs"><a href="#opt-max-jobs"><code>--max-jobs</code></a></span> / <code>-j</code> <em>number</em></li>
</ul>
<p>Sets the maximum number of build jobs that Lix will perform in parallel to the specified number.
Specify <code>auto</code> to use the number of CPUs in the system.
The default is specified by the <code>max-jobs</code> configuration setting, which itself defaults to <code>1</code>.
A higher value is useful on SMP systems or to exploit I/O latency.</p>
<p>Setting it to <code>0</code> disallows building on the local machine, which is useful when you want builds to happen only on remote builders.</p>
<ul>
<li><span id="opt-cores"><a href="#opt-cores"><code>--cores</code></a></span></li>
</ul>
<p>Sets the value of the <code>NIX_BUILD_CORES</code> environment variable in the invocation of builders.
Builders can use this variable at their discretion to control the maximum amount of parallelism.
For instance, in Nixpkgs, if the derivation attribute <code>enableParallelBuilding</code> is set to <code>true</code>, the builder passes the <code>-jN</code> flag to GNU Make.
It defaults to the value of the <code>cores</code> configuration setting, if set, or <code>1</code> otherwise.
The value <code>0</code> means that the builder should use all available CPU cores in the system.</p>
<ul>
<li><span id="opt-max-silent-time"><a href="#opt-max-silent-time"><code>--max-silent-time</code></a></span></li>
</ul>
<p>Sets the maximum number of seconds that a builder can go without producing any data on standard output or standard error.
The default is specified by the <code>max-silent-time</code> configuration setting.
<code>0</code> means no time-out.</p>
<ul>
<li><span id="opt-timeout"><a href="#opt-timeout"><code>--timeout</code></a></span></li>
</ul>
<p>Sets the maximum number of seconds that a builder can run.
The default is specified by the <code>timeout</code> configuration setting.
<code>0</code> means no timeout.</p>
<ul>
<li><span id="opt-keep-going"><a href="#opt-keep-going"><code>--keep-going</code></a></span> / <code>-k</code></li>
</ul>
<p>Keep going in case of failed builds, to the greatest extent possible.
That is, if building an input of some derivation fails, Lix will still build the other inputs, but not the derivation itself.
Without this option, Lix stops if any build fails (except for builds of substitutes), possibly killing builds in progress (in case of parallel or distributed builds).</p>
<ul>
<li><span id="opt-keep-failed"><a href="#opt-keep-failed"><code>--keep-failed</code></a></span> / <code>-K</code></li>
</ul>
<p>Specifies that in case of a build failure, the temporary directory (usually in <code>/tmp</code>) in which the build takes place should not be deleted.
The path of the build directory is printed as an informational message.</p>
<ul>
<li><span id="opt-fallback"><a href="#opt-fallback"><code>--fallback</code></a></span></li>
</ul>
<p>Whenever Lix attempts to build a derivation for which substitutes are known for each output path, but realising the output paths through the substitutes fails, fall back on building the derivation.</p>
<p>The most common scenario in which this is useful is when we have registered substitutes in order to perform binary distribution from, say, a network repository.
If the repository is down, the realisation of the derivation will fail.
When this option is specified, Lix will build the derivation instead.
Thus, installation from binaries falls back on installation from source.
This option is not the default since it is generally not desirable for a transient failure in obtaining the substitutes to lead to a full build from source (with the related consumption of resources).</p>
<ul>
<li><span id="opt-readonly-mode"><a href="#opt-readonly-mode"><code>--readonly-mode</code></a></span></li>
</ul>
<p>When this option is used, no attempt is made to open the Lix database.
Most Lix operations do need database access, so those operations will fail.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>FIXME(Lix): sometimes you want <code>--store dummy</code> instead, because this option sometimes doesn't work. Document why this is.</p>
</div>
<ul>
<li><span id="opt-arg"><a href="#opt-arg"><code>--arg</code></a></span> <em>name</em> <em>value</em></li>
</ul>
<p>This option is accepted by <code>nix-env</code>, <code>nix-instantiate</code>, <code>nix-shell</code> and <code>nix-build</code>.
When evaluating Nix expressions, the expression evaluator will automatically try to call functions that it encounters.
It can automatically call functions for which every argument has a <a href="../../../language/constructs/#functions">default value</a> (e.g., <code>{ argName ? defaultValue }: ...</code>).</p>
<p>With <code>--arg</code>, you can also call functions that have arguments without a default value (or override a default value).
That is, if the evaluator encounters a function with an argument named <em>name</em>, it will call it with value <em>value</em>.</p>
<p>For instance, the top-level <code>default.nix</code> in Nixpkgs is actually a function:</p>
<div class="highlight"><pre><span></span><code><span class="p">{</span> <span class="c1">## The system (e.g., `i686-linux&#39;) for which to build the packages.</span>
system <span class="o">?</span> <span class="nb">builtins</span><span class="o">.</span>currentSystem
<span class="o">...</span>
<span class="p">}:</span> <span class="o">...</span>
</code></pre></div>
<p>So if you call this Nix expression (e.g., when you do <code>nix-env --install --attr pkgname</code>), the function will be called automatically using the value <a href="../../../language/builtins/"><code>builtins.currentSystem</code></a> for the <code>system</code> argument.
You can override this using <code>--arg</code>, e.g., <code>nix-env --install --attr pkgname --arg system "i686-freebsd"</code>.
(Note that since the argument is a Nix string literal, you have to escape the quotes.)</p>
<ul>
<li><span id="opt-argstr"><a href="#opt-argstr"><code>--argstr</code></a></span> <em>name</em> <em>value</em></li>
</ul>
<p>This option is like <code>--arg</code>, only the value is not a Nix expression but a string.
So instead of <code>--arg system "i686-linux"</code> (the outer quotes are to keep the shell happy) you can say <code>--argstr system i686-linux</code>.</p>
<ul>
<li><span id="opt-attr"><a href="#opt-attr"><code>--attr</code></a></span> / <code>-A</code> <em>attrPath</em></li>
</ul>
<p>Select an attribute from the top-level Nix expression being evaluated.
(<code>nix-env</code>, <code>nix-instantiate</code>, <code>nix-build</code> and <code>nix-shell</code> only.)
The <em>attribute path</em> <em>attrPath</em> is a sequence of attribute names separated by dots.
For instance, given a top-level Nix expression <em>e</em>, the attribute path <code>xorg.xorgserver</code> would cause the expression <code>e.xorg.xorgserver</code> to be used.
See <a href="../install/"><code>nix-env --install</code></a> for some concrete examples.</p>
<p>In addition to attribute names, you can also specify array indices.
For instance, the attribute path <code>foo.3.bar</code> selects the <code>bar</code>
attribute of the fourth element of the array in the <code>foo</code> attribute
of the top-level expression.</p>
<ul>
<li><span id="opt-expr"><a href="#opt-expr"><code>--expr</code></a></span> / <code>-E</code></li>
</ul>
<p>Interpret the command line arguments as a list of Nix expressions to be parsed and evaluated, rather than as a list of file names of Nix expressions.
(<code>nix-instantiate</code>, <code>nix-build</code> and <code>nix-shell</code> only.)</p>
<p>For <code>nix-shell</code>, this option is commonly used to give you a shell in which you can build the packages returned by the expression.
If you want to get a shell which contain the <em>built</em> packages ready for use, give your expression to the <code>nix-shell --packages</code> convenience flag instead.</p>
<ul>
<li><span id="opt-I"><a href="#opt-I"><code>-I</code></a></span> <em>path</em></li>
</ul>
<p>Add an entry to the <a href="../../conf-file/#conf-nix-path">Nix expression search path</a>.
This option may be given multiple times.
Paths added through <code>-I</code> take precedence over <a href="../../env-common/#env-NIX_PATH"><code>NIX_PATH</code></a>.</p>
<ul>
<li><span id="opt-option"><a href="#opt-option"><code>--option</code></a></span> <em>name</em> <em>value</em></li>
</ul>
<p>Set the Lix configuration option <em>name</em> to <em>value</em>.
This overrides settings in the Lix configuration file (see nix.conf(5)).</p>
<ul>
<li><span id="opt-repair"><a href="#opt-repair"><code>--repair</code></a></span></li>
</ul>
<p>Fix corrupted or missing store paths by redownloading or rebuilding them.
Note that this is slow because it requires computing a cryptographic hash of the contents of every path in the closure of the build.
Also note the warning under <code>nix-store --repair-path</code>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>See <a href="../../conf-file/#command-line-flags"><code>man nix.conf</code></a> for overriding configuration settings with command line flags.</p>
</div>
<h2 id="environment-variables">Environment variables</h2>
<ul>
<li><code>NIX_PROFILE</code>
Location of the Nix profile. Defaults to the target of the symlink
<code>~/.nix-profile</code>, if it exists, or <code>/nix/var/nix/profiles/default</code>
otherwise.</li>
</ul>
<h2 id="common-environment-variables">Common Environment Variables</h2>
<p>Most commands in Lix interpret the following environment variables:</p>
<ul>
<li>
<p><span id="env-IN_NIX_SHELL"><a href="#env-IN_NIX_SHELL"><code>IN_NIX_SHELL</code></a></span>
Indicator that tells if the current environment was set up by
<code>nix-shell</code>. It can have the values <code>pure</code> or <code>impure</code>.</p>
</li>
<li>
<p><span id="env-NIX_PATH"><a href="#env-NIX_PATH"><code>NIX_PATH</code></a></span>
A colon-separated list of directories used to look up the location of Nix
expressions using <a href="../../../language/values/#type-path">paths</a>
enclosed in angle brackets (i.e., <code>&lt;path&gt;</code>),
e.g. <code>/home/eelco/Dev:/etc/nixos</code>. It can be extended using the
<a href="../../opt-common/#opt-I"><code>-I</code> option</a>.</p>
<p>If <code>NIX_PATH</code> is not set at all, Lix will fall back to the following list in <a href="../../conf-file/#conf-pure-eval">impure</a> and <a href="../../conf-file/#conf-restrict-eval">unrestricted</a> evaluation mode:</p>
<ol>
<li><code>$HOME/.nix-defexpr/channels</code></li>
<li><code>nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs</code></li>
<li><code>/nix/var/nix/profiles/per-user/root/channels</code></li>
</ol>
<p>If <code>NIX_PATH</code> is set to an empty string, resolving search paths will always fail.
For example, attempting to use <code>&lt;nixpkgs&gt;</code> will produce:</p>
<div class="highlight"><pre><span></span><code>error: file &#39;nixpkgs&#39; was not found in the Nix search path
</code></pre></div>
</li>
<li>
<p><span id="env-NIX_IGNORE_SYMLINK_STORE"><a href="#env-NIX_IGNORE_SYMLINK_STORE"><code>NIX_IGNORE_SYMLINK_STORE</code></a></span>
Normally, the Nix store directory (typically <code>/nix/store</code>) is not
allowed to contain any symlink components. This is to prevent
“impure” builds. Builders sometimes “canonicalise” paths by
resolving all symlink components. Thus, builds on different machines
(with <code>/nix/store</code> resolving to different locations) could yield
different results. This is generally not a problem, except when
builds are deployed to machines where <code>/nix/store</code> resolves
differently. If you are sure that youre not going to do that, you
can set <code>NIX_IGNORE_SYMLINK_STORE</code> to <code>1</code>.</p>
<p>Note that if youre symlinking the Nix store so that you can put it
on another file system than the root file system, on Linux youre
better off using <code>bind</code> mount points, e.g.,</p>
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>mkdir<span class="w"> </span>/nix
<span class="gp">$ </span>mount<span class="w"> </span>-o<span class="w"> </span><span class="nb">bind</span><span class="w"> </span>/mnt/otherdisk/nix<span class="w"> </span>/nix
</code></pre></div>
<p>Consult the mount 8 manual page for details.</p>
</li>
<li>
<p><span id="env-NIX_STORE_DIR"><a href="#env-NIX_STORE_DIR"><code>NIX_STORE_DIR</code></a></span>
Overrides the location of the Nix store (default <code>prefix/store</code>).</p>
</li>
<li>
<p><span id="env-NIX_DATA_DIR"><a href="#env-NIX_DATA_DIR"><code>NIX_DATA_DIR</code></a></span>
Overrides the location of the Lix static data directory (default
<code>prefix/share</code>).</p>
</li>
<li>
<p><span id="env-NIX_LOG_DIR"><a href="#env-NIX_LOG_DIR"><code>NIX_LOG_DIR</code></a></span>
Overrides the location of the Lix log directory (default
<code>prefix/var/log/nix</code>).</p>
</li>
<li>
<p><span id="env-NIX_STATE_DIR"><a href="#env-NIX_STATE_DIR"><code>NIX_STATE_DIR</code></a></span>
Overrides the location of the Lix state directory (default
<code>prefix/var/nix</code>).</p>
</li>
<li>
<p><span id="env-NIX_CONF_DIR"><a href="#env-NIX_CONF_DIR"><code>NIX_CONF_DIR</code></a></span>
Overrides the location of the system Lix configuration directory
(default <code>prefix/etc/nix</code>).</p>
</li>
<li>
<p><span id="env-NIX_CONFIG"><a href="#env-NIX_CONFIG"><code>NIX_CONFIG</code></a></span>
Applies settings from Lix configuration from the environment.
The content is treated as if it was read from a Lix configuration file.
Settings are separated by the newline character.</p>
</li>
<li>
<p><span id="env-NIX_USER_CONF_FILES"><a href="#env-NIX_USER_CONF_FILES"><code>NIX_USER_CONF_FILES</code></a></span>
Overrides the location of the Lix user configuration files to load from.</p>
<p>The default are the locations according to the <a href="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG Base Directory Specification</a>.
See the <a href="#xdg-base-directories">XDG Base Directories</a> sub-section for details.</p>
<p>The variable is treated as a list separated by the <code>:</code> token.</p>
</li>
<li>
<p><span id="env-TMPDIR"><a href="#env-TMPDIR"><code>TMPDIR</code></a></span>
Use the specified directory to store temporary files. In particular,
this includes temporary build directories; these can take up
substantial amounts of disk space. The default is <code>/tmp</code>.</p>
</li>
<li>
<p><span id="env-NIX_REMOTE"><a href="#env-NIX_REMOTE"><code>NIX_REMOTE</code></a></span>
This variable should be set to <code>daemon</code> if you want to use the Lix
daemon to execute Nix operations. This is necessary in <a href="../../../installation/multi-user/">multi-user
Nix installations</a>. If the Lix
daemon's Unix socket is at some non-standard path, this variable
should be set to <code>unix://path/to/socket</code>. Otherwise, it should be
left unset.</p>
</li>
<li>
<p><span id="env-NIX_SHOW_STATS"><a href="#env-NIX_SHOW_STATS"><code>NIX_SHOW_STATS</code></a></span>
If set to <code>1</code>, Lix will print some evaluation statistics, such as
the number of values allocated.</p>
</li>
<li>
<p><span id="env-NIX_COUNT_CALLS"><a href="#env-NIX_COUNT_CALLS"><code>NIX_COUNT_CALLS</code></a></span>
If set to <code>1</code>, Lix will print how often functions were called during
Nix expression evaluation. This is useful for profiling your Nix
expressions.</p>
</li>
<li>
<p><span id="env-GC_INITIAL_HEAP_SIZE"><a href="#env-GC_INITIAL_HEAP_SIZE"><code>GC_INITIAL_HEAP_SIZE</code></a></span>
If Nix has been configured to use the Boehm garbage collector, this
variable sets the initial size of the heap in bytes. It defaults to
384 MiB. Setting it to a low value reduces memory consumption, but
will increase runtime due to the overhead of garbage collection.</p>
</li>
</ul>
<h3 id="xdg-base-directories">XDG Base Directories</h3>
<p>Lix follows the <a href="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG Base Directory Specification</a>.</p>
<p>For backwards compatibility, commands in Lix will follow the standard only when [<code>use-xdg-base-directories</code>] is enabled.
<a href="../../New-CLI/nix/">New Nix commands</a> (experimental) conform to the standard by default.</p>
<p>The following environment variables are used to determine locations of various state and configuration files:</p>
<ul>
<li><code>XDG_CONFIG_HOME</code> (default <code>~/.config</code>)</li>
<li><code>XDG_STATE_HOME</code> (default <code>~/.local/state</code>)</li>
<li><code>XDG_CACHE_HOME</code> (default <code>~/.cache</code>)</li>
</ul>
<h2 id="examples">Examples</h2>
<h3 id="delete-explicit-generation-numbers">Delete explicit generation numbers</h3>
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>nix-env<span class="w"> </span>--delete-generations<span class="w"> </span><span class="m">3</span><span class="w"> </span><span class="m">4</span><span class="w"> </span><span class="m">8</span>
</code></pre></div>
<p>Delete the generations numbered 3, 4, and 8, so long as the current active generation is not any of those.</p>
<h3 id="keep-most-recent-by-count-number-of-generations">Keep most-recent by count (number of generations)</h3>
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>nix-env<span class="w"> </span>--delete-generations<span class="w"> </span>+5
</code></pre></div>
<p>Suppose <code>30</code> is the current generation, and we currently have generations numbered <code>20</code> through <code>32</code>.</p>
<p>Then this command will delete generations <code>20</code> through <code>25</code> (<code>&lt;= 30 - 5</code>),
and keep generations <code>26</code> through <code>31</code> (<code>&gt; 30 - 5</code>).</p>
<h3 id="keep-most-recent-by-time-number-of-days">Keep most-recent by time (number of days)</h3>
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>nix-env<span class="w"> </span>--delete-generations<span class="w"> </span>30d
</code></pre></div>
<p>This command will delete all generations older than 30 days, except for the generation that was active 30 days ago (if it currently exists).</p>
<h3 id="delete-all-older">Delete all older</h3>
<div class="highlight"><pre><span></span><code><span class="gp">$ </span>nix-env<span class="w"> </span>--profile<span class="w"> </span>other_profile<span class="w"> </span>--delete-generations<span class="w"> </span>old
</code></pre></div>
</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>