|
| 1 | +[% WRAPPER layout.tt title="Getting Nix / NixOS" hideTitle=1 menu='nixos' %] |
| 2 | +[% USE IO.All %] |
| 3 | +[% USE JSON.Escape %] |
| 4 | + |
| 5 | +<h1>Getting Nix</h1> |
| 6 | + |
| 7 | +<p class="lead"> |
| 8 | + Below you will find installation instructions for Nix, the package manager. |
| 9 | + Nix is currently supported on <strong>Linux</strong> and <strong>Mac</strong>. |
| 10 | + The latest stable release is <strong>[%latestNixVersion%]</strong> |
| 11 | +</p> |
| 12 | + |
| 13 | +<ul id="getting-nix" class="nav nav-tabs"> |
| 14 | + <li class="active"><a href="#nix-quick-install">Quick install</a></li> |
| 15 | + <li><a href="#nix-verify-installation">Verify installation (GPG)</a></li> |
| 16 | + <li><a href="#nix-uninstall">Uninstall</a></li> |
| 17 | + <li><a href="#nix-more">More ...</a></li> |
| 18 | +</ul> |
| 19 | + |
| 20 | +<div class="tab-content"> |
| 21 | + <section class="tab-pane active" id="nix-quick-install"> |
| 22 | + The quickest way to install Nix is to run the following in a shell (as a |
| 23 | + user other than <code>root</code>): |
| 24 | + <pre class="well" style="margin-top:1em"> |
| 25 | +<span class="nix-command">curl -L --proto '=https' --tlsv1.2 https://nixos.org/nix/install | sh</span></pre> |
| 26 | + <p>Make sure to follow the instructions output by the script.</p> |
| 27 | + <p>The installation script requires that you have <code>sudo</code> access to <code>root</code>.</p> |
| 28 | + </section> |
| 29 | + <section class="tab-pane" id="nix-verify-installation"> |
| 30 | + <p>You may want to verify the integrity of the installation script using GPG:</p> |
| 31 | + <pre class="well"> |
| 32 | +<span class="nix-command">curl -o install-nix-[%latestNixVersion%] https://releases.nixos.org/nix/nix-[%latestNixVersion%]/install</span> |
| 33 | +<span class="nix-command">curl -o install-nix-[%latestNixVersion%].asc https://releases.nixos.org/nix/nix-[%latestNixVersion%]/install.asc</span> |
| 34 | +<span class="nix-command">gpg2 --recv-keys B541D55301270E0BCF15CA5D8170B4726D7198DE</span> |
| 35 | +<span class="nix-command">gpg2 --verify ./install-nix-[%latestNixVersion%].asc</span> |
| 36 | +<span class="nix-command">sh ./install-nix-[%latestNixVersion%]</span></pre> |
| 37 | + <p> |
| 38 | + The <a href="[%root%]edolstra.gpg">signing key</a> has fingerprint |
| 39 | + <code>B541 D553 0127 0E0B CF15 CA5D 8170 B472 6D71 98DE</code>. |
| 40 | + It is also available |
| 41 | + <a href="https://github.com/NixOS/nixos-homepage/blob/master/edolstra.gpg">on GitHub</a>. |
| 42 | + </p> |
| 43 | + </section> |
| 44 | + <section class="tab-pane" id="nix-uninstall"> |
| 45 | + <p> |
| 46 | + You can uninstall Nix simply by running <code>rm -rf /nix</code>. |
| 47 | + </p> |
| 48 | + <!-- TODO: expand this https://github.com/NixOS/nix/issues/1402 --> |
| 49 | + </section> |
| 50 | + <section class="tab-pane" id="nix-more"> |
| 51 | + <p>See <a href="[%nixManual%]#chap-installation">the manual</a> for more information.</p> |
| 52 | + <p>The following artifacts are also available:</p> |
| 53 | + <ul> |
| 54 | + <li><a href="[%latestNixMirror%]/nix-[%latestNixVersion%].tar.xz">Source tarball</a>.</li> |
| 55 | + <li><a href="[%nixManual%]#ssec-relnotes-[%latestNixVersion%]">Release notes</a>.</li> |
| 56 | + <li> |
| 57 | + <a href="[%nixManual%]">Manual</a>. |
| 58 | + Please read the <a href="[%nixManual%]#chap-quick-start">“Quick Start” section of the manual</a> |
| 59 | + for an overview of how to install and use Nix. |
| 60 | + </li> |
| 61 | + <li>Old releases are <a href="/releases/nix">also available</a>.</li> |
| 62 | + </ul> |
| 63 | + </section> |
| 64 | +</div> |
| 65 | + |
| 66 | +<script charset="utf-8"> |
| 67 | + $('#getting-nix a').click(function (e) { |
| 68 | + e.preventDefault(); |
| 69 | + $(this).tab('show'); |
| 70 | + }) |
| 71 | + |
| 72 | +</script> |
| 73 | + |
| 74 | + |
| 75 | +<h1>Getting NixOS</h1> |
| 76 | + |
| 77 | +<p class="lead"> |
| 78 | + Below you will find installation instructions for NixOS, the linux |
| 79 | + distribution. The latest stable release series is |
| 80 | + <strong>[%latestNixOSSeries%]</strong> |
| 81 | +</p> |
| 82 | + |
| 83 | +<ul id="getting-nixos" class="nav nav-tabs"> |
| 84 | + <li class="active"><a href="#nixos-iso">ISO image</a></li> |
| 85 | + <li><a href="#nixos-virtualbox">VirtualBox</a></li> |
| 86 | + <li><a href="#nixos-amazon">Amazon EC2</a></li> |
| 87 | + <li><a href="#nixos-azure">Microsoft Azure</a></li> |
| 88 | + <li><a href="#nixos-google">Google Compute Engine</a></li> |
| 89 | + <li><a href="#nixos-more">More ...</a></li> |
| 90 | +</ul> |
| 91 | + |
| 92 | +<div class="tab-content"> |
| 93 | + <section class="tab-pane active" id="nixos-iso"> |
| 94 | + <p>You can install NixOS on physical hardware by burning one of the CD |
| 95 | + images onto a blank CD/DVD disk, or <a href="https://nixos.org/nixos/manual/index.html#sec-booting-from-usb">by |
| 96 | + copying it onto a USB stick</a>. For <strong>installation |
| 97 | + instructions</strong>, please see the <a href="[%nixosManual%]">manual</a>.</p> |
| 98 | + |
| 99 | + <div class="alert alert-block"> |
| 100 | + Please note that NixOS at the moment lacks a nice, user-friendly |
| 101 | + graphical installer. Therefore this form of installation may not be |
| 102 | + suitable for novice Linux users.</div> |
| 103 | + |
| 104 | + <p>The <strong>graphical installation CD</strong> contains the NixOS |
| 105 | + installer as well as X11, Plasma 5 Desktop and several applications. It’s a |
| 106 | + <em>live CD</em>, so it allows you to get an impression of NixOS (and |
| 107 | + the Nix package manager) before installing it.</p> |
| 108 | + |
| 109 | + [% prefix = "https://channels.nixos.org/nixos-" _ latestNixOSSeries %] |
| 110 | + |
| 111 | + <ul> |
| 112 | + <li><a href="[%prefix%]/latest-nixos-graphical-x86_64-linux.iso">Graphical live CD, 64-bit Intel/AMD</a> (<a |
| 113 | + href="[%prefix%]/latest-nixos-graphical-x86_64-linux.iso.sha256">SHA-256</a>) |
| 114 | + <span class="label label-info">Recommended for most users</span></li> |
| 115 | + </ul> |
| 116 | + |
| 117 | + <p>The <strong>minimal installation CD</strong> does not contain X11, |
| 118 | + and is therefore a lot smaller. You have to run the installer from |
| 119 | + the console. It contains a number of rescue tools.</p> |
| 120 | + |
| 121 | + <ul> |
| 122 | + <li><a href="[%prefix%]/latest-nixos-minimal-x86_64-linux.iso">Minimal installation CD, 64-bit Intel/AMD</a> (<a |
| 123 | + href="[%prefix%]/latest-nixos-minimal-x86_64-linux.iso.sha256">SHA-256</a>)</li> |
| 124 | + <li><a href="[%prefix%]/latest-nixos-minimal-i686-linux.iso">Minimal installation CD, 32-bit Intel/AMD</a> (<a |
| 125 | + href="[%prefix%]/latest-nixos-minimal-i686-linux.iso.sha256">SHA-256</a>)</li> |
| 126 | + </ul> |
| 127 | + </section> |
| 128 | + <section class="tab-pane" id="nixos-virtualbox"> |
| 129 | + <p>This is a demo appliance for VirtualBox (in OVA format) that has |
| 130 | + X11 and Plasma 5 enabled, as well as the VirtualBox guest additions. To |
| 131 | + use it, download the OVA file, open VirtualBox, run “File → Import |
| 132 | + Appliance” from the menu, select the OVA file, and click “Import”. |
| 133 | + You can then start the virtual machine. When the KDE login screen |
| 134 | + appears, you can log in as <strong>user <code>demo</code></strong>, |
| 135 | + <strong>password <code>demo</code></strong>. To obtain a root shell, run |
| 136 | + <code>sudo -i</code> in the KDE terminal (<code>konsole</code>).</p> |
| 137 | + |
| 138 | + <ul> |
| 139 | + <li><a href="[%prefix%]/latest-nixos-x86_64-linux.ova">VirtualBox appliance, 64-bit Intel/AMD</a> (<a |
| 140 | + href="[%prefix%]/latest-nixos-x86_64-linux.ova.sha256">SHA-256</a>)</li> |
| 141 | + </ul> |
| 142 | + </section> |
| 143 | + <section class="tab-pane" id="nixos-amazon"> |
| 144 | + <p>If you are an EC2 user, you can fire up a NixOS instance instantly |
| 145 | + by using one of the AMIs listed below.</p> |
| 146 | + |
| 147 | + <div class="row"> |
| 148 | + <table class="table"> |
| 149 | + <thead> |
| 150 | + <tr> |
| 151 | + <th>Region</th> |
| 152 | + <th>Root storage</th> |
| 153 | + <th>Virtualisation</th> |
| 154 | + <th>AMI</th> |
| 155 | + <th></th> |
| 156 | + </tr> |
| 157 | + </thead> |
| 158 | + <tbody> |
| 159 | + [% amis = JSON.Escape.json_decode(IO.All.new(nixosAmis).all).$latestNixOSSeries %] |
| 160 | + [% FOREACH region IN amis.keys.sort %] |
| 161 | + [% FOREACH type IN amis.$region.keys.sort; ami = amis.$region.$type %] |
| 162 | + <tr> |
| 163 | + <td><code>[% region %]</code></td> |
| 164 | + <td>[% IF type.search("ebs"); THEN; "EBS"; ELSE; "Instance"; END; %]</td> |
| 165 | + <td>[% IF type.search("hvm"); THEN; "Hardware"; ELSE; "Para"; END; %]</td> |
| 166 | + <td><code>[% ami %]</code></td> |
| 167 | + <td><a href="https://console.aws.amazon.com/ec2/home?region=[%region%]#launchAmi=[%ami%]" |
| 168 | + class="btn btn-primary btn-mini">Launch</a></td> |
| 169 | + </tr> |
| 170 | + [% END %] |
| 171 | + [% END %] |
| 172 | + </tbody> |
| 173 | + </table> |
| 174 | + </div> |
| 175 | + |
| 176 | + <p>You can create an instance using the AWS Management Console by |
| 177 | + clicking one of the Launch buttons. You can also create an instance |
| 178 | + from the command line. For example, to create an instance in region |
| 179 | + <code>[% region = "eu-west-1"; type = "pv-ebs"; ami = |
| 180 | + amis.$region.$type; region %]</code> using the EC2 API tools, just |
| 181 | + run:</p> |
| 182 | + |
| 183 | + <pre class="well"> |
| 184 | + $ ec2-run-instances [% ami %] --region [% region %] -k <em>my-key-pair</em></pre> |
| 185 | + </section> |
| 186 | + <section class="tab-pane" id="nixos-azure"> |
| 187 | + <p>If you are an Azure user, you can manually create a NixOS instance |
| 188 | + by using one of the bootstrap BLOBs listed below.</p> |
| 189 | + |
| 190 | + <div class="row"> |
| 191 | + <table class="table"> |
| 192 | + <thead> |
| 193 | + <tr> |
| 194 | + <th>NixOS version</th> |
| 195 | + <th>BLOB URL</th> |
| 196 | + </tr> |
| 197 | + </thead> |
| 198 | + <tbody> |
| 199 | + [% blobs = JSON.Escape.json_decode(IO.All.new(nixosAzureBlobs).all) %] |
| 200 | + [% FOREACH version IN blobs.keys.sort; blob = blobs.$version %] |
| 201 | + <tr> |
| 202 | + <td><code>[% version %]</code></td> |
| 203 | + <td><a href="[% blob %]"><code>[% blob %]</code></a></td> |
| 204 | + </tr> |
| 205 | + [% END %] |
| 206 | + </tbody> |
| 207 | + </table> |
| 208 | + </div> |
| 209 | + |
| 210 | + <p>You can create an instance from the command line. |
| 211 | + For example, to create an instance of version |
| 212 | + <code>[% blob = blobs.$latestNixOSSeries; latestNixOSSeries %]</code> |
| 213 | + of NixOS using azure-cli, just run:</p> |
| 214 | + |
| 215 | + <pre class="well"> |
| 216 | +# settings |
| 217 | +# vm name must be lowercase and letters/numbers only because it's also used as the domain name |
| 218 | +export VM_NAME="nixosvm" |
| 219 | +export RESOURCE_GROUP="rg-nixosvm" |
| 220 | +export LOCATION="eastus" |
| 221 | +export STORAGE_ACCOUNT="nixosvm" |
| 222 | +export SOURCE_URI="<code>[% blob %]</code>" |
| 223 | + |
| 224 | +# create group |
| 225 | +az group create \ |
| 226 | + --name "$RESOURCE_GROUP" \ |
| 227 | + --location "$LOCATION |
| 228 | + |
| 229 | +# create storage |
| 230 | +az storage account create \ |
| 231 | + --name "$STORAGE_ACCOUNT" \ |
| 232 | + --group "$RESOURCE_GROUP" \ |
| 233 | + --location "$LOCATION" \ |
| 234 | + --sku Standard_LRS |
| 235 | + |
| 236 | +az storage account keys list \ |
| 237 | + --name "$STORAGE_ACCOUNT" \ |
| 238 | + --group $RESOURCE_GROUP |
| 239 | + |
| 240 | +# export one of the storage access keys |
| 241 | +export STORAGE_ACCOUNT_KEY="..." |
| 242 | +echo $STORAGE_ACCOUNT_KEY |
| 243 | + |
| 244 | +az storage container create \ |
| 245 | + --account-name "$STORAGE_ACCOUNT" |
| 246 | + --account-key "$STORAGE_ACCOUNT_KEY" |
| 247 | + --name vm-images |
| 248 | + |
| 249 | +# copy the image blob |
| 250 | +az storage blob copy start \ |
| 251 | + --source-uri "$SOURCE_URI" \ |
| 252 | + --destination-blob "nixos-unstable-nixops.vhd" \ |
| 253 | + --destination-container "vm-images" \ |
| 254 | + --account-name "$STORAGE_ACCOUNT" \ |
| 255 | + --account-key "$STORAGE_ACCOUNT_KEY" |
| 256 | + |
| 257 | +# wait for blob copy status to change pending->success |
| 258 | +az storage blob show \ |
| 259 | + --name "nixos-unstable-nixops.vhd" \ |
| 260 | + --container-name "vm-images" \ |
| 261 | + --account-name "$STORAGE_ACCOUNT" \ |
| 262 | + --account-key "$STORAGE_ACCOUNT_KEY" |
| 263 | + |
| 264 | + |
| 265 | +# create vm |
| 266 | +az vm create \ |
| 267 | + --name "$VM_NAME" \ |
| 268 | + --resource-group "$RESOURCE_GROUP" \ |
| 269 | + --location "$LOCATION" \ |
| 270 | + --public-ip-address-dns-name "$VM_NAME" \ |
| 271 | + --image "https://$STORAGE_ACCOUNT.blob.core.windows.net/vm-images/nixos-unstable-nixops.vhd" \ |
| 272 | + --storage-account "$STORAGE_ACCOUNT" \ |
| 273 | + --storage-container-name "$VM_NAME" \ |
| 274 | + --use-unmanaged-disk \ |
| 275 | + --os-disk-size-gb "32" \ |
| 276 | + --os-type linux \ |
| 277 | + --admin-username "azureuser" \ |
| 278 | + --generate-ssh-keys |
| 279 | + |
| 280 | +# show machine properties and log in |
| 281 | +az vm show \ |
| 282 | + --name "$VM" \ |
| 283 | + --resource-group "$GROUP" |
| 284 | + |
| 285 | +ssh azureuser@"$VM_NAME"."$LOCATION".cloudapp.azure.com</pre> |
| 286 | + </section> |
| 287 | + <section class="tab-pane" id="nixos-google"> |
| 288 | + <p>If you are Google Cloud Platform user, you can create a NixOS image using one of the raw disks listed below. You |
| 289 | + can then create a NixOS instance using the image.</p> |
| 290 | + |
| 291 | + <div class="row"> |
| 292 | + <table class="table"> |
| 293 | + <thead> |
| 294 | + <tr> |
| 295 | + <th>NixOS version</th> |
| 296 | + <th>URL</th> |
| 297 | + </tr> |
| 298 | + </thead> |
| 299 | + <tbody> |
| 300 | + [% images = JSON.Escape.json_decode(IO.All.new(nixosGCE).all) %] |
| 301 | + [% FOREACH version IN images.keys.sort; url = images.$version %] |
| 302 | + <tr> |
| 303 | + <td><code>[% version %]</code></td> |
| 304 | + <td><a href="[% url %]"><code>[% url %]</code></a></td> |
| 305 | + </tr> |
| 306 | + [% END %] |
| 307 | + </tbody> |
| 308 | + </table> |
| 309 | + </div> |
| 310 | + |
| 311 | + <p>For example:</p> |
| 312 | + |
| 313 | + <pre class="well"> |
| 314 | +image=my-nixos-image |
| 315 | +source_uri=https://storage.googleapis.com/nixos-cloud-images/nixos-image-18.09.1228.a4c4cbb613c-x86_64-linux.raw.tar.gz |
| 316 | +source_uri=$(sed 's%gs:/%https://storage.googleapis.com%' <<< $source_uri) |
| 317 | +gcloud compute images create $image --source-uri=$source_uri |
| 318 | +gcloud compute instances create instance-1 --image=$image</pre> |
| 319 | + </section> |
| 320 | + <section class="tab-pane" id="nixos-more"> |
| 321 | + <h2 id="unstable-releases">Unstable releases</h2> |
| 322 | + |
| 323 | + <p>If you are a developer who wants to contribute to NixOS, or if you |
| 324 | + just want the latest and greatest, you can also install the <a |
| 325 | + href="https://nixos.org/channels/nixos-unstable">most |
| 326 | + recent unstable |
| 327 | + release</a>.</p> |
| 328 | + </section> |
| 329 | +</div> |
| 330 | + |
| 331 | +<script charset="utf-8"> |
| 332 | + $('#getting-nixos a').click(function (e) { |
| 333 | + e.preventDefault(); |
| 334 | + $(this).tab('show'); |
| 335 | + }) |
| 336 | + |
| 337 | +</script> |
| 338 | + |
| 339 | +[% END %] |
0 commit comments