Skip to content

Commit

Permalink
Remove Azure image tab
Browse files Browse the repository at this point in the history
It's very outdated.

Also update this flake to use NixOS 20.03.
  • Loading branch information
edolstra committed Apr 14, 2020
1 parent f860143 commit 4ebccef
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 140 deletions.
1 change: 0 additions & 1 deletion Makefile
Expand Up @@ -89,7 +89,6 @@ favicon.ico: favicon.png
--define root=$(ROOT) \
--define fileName=$< \
--define nixosAmis=$(NIXOS_AMIS) \
--define nixosAzureBlobs=$(NIXOS_AZURE_BLOBS) \
--define nixosGCE=$(NIXOS_GCE) \
--pre_process=nix-release.tt --pre_process=nixos-release.tt --pre_process=common.tt \
$< > $@.tmp
Expand Down
112 changes: 6 additions & 106 deletions download.tt
Expand Up @@ -26,6 +26,7 @@
<p>Make sure to follow the instructions output by the script.</p>
<p>The installation script requires that you have <code>sudo</code> access to <code>root</code>.</p>
</section>

<section class="tab-pane" id="nix-verify-installation">
<p>You may want to verify the integrity of the installation script using GPG:</p>
<pre class="well">
Expand All @@ -41,12 +42,14 @@
<a href="https://github.com/NixOS/nixos-homepage/blob/master/edolstra.gpg">on GitHub</a>.
</p>
</section>

<section class="tab-pane" id="nix-uninstall">
<p>
You can uninstall Nix simply by running <code>rm -rf /nix</code>.
</p>
<!-- TODO: expand this https://github.com/NixOS/nix/issues/1402 -->
</section>

<section class="tab-pane" id="nix-more">
<p>The following release items are also available:</p>
<ul>
Expand Down Expand Up @@ -83,7 +86,6 @@
<li class="active"><a href="#nixos-iso">ISO image</a></li>
<li><a href="#nixos-virtualbox">VirtualBox</a></li>
<li><a href="#nixos-amazon">Amazon EC2</a></li>
<li><a href="#nixos-azure">Microsoft Azure</a></li>
<li><a href="#nixos-google">Google Compute Engine</a></li>
<li><a href="#nixos-more">More ...</a></li>
</ul>
Expand Down Expand Up @@ -124,6 +126,7 @@
href="[%prefix%]/latest-nixos-minimal-i686-linux.iso.sha256">SHA-256</a>)</li>
</ul>
</section>

<section class="tab-pane" id="nixos-virtualbox">
<p>This is a demo appliance for VirtualBox (in OVA format) that has
X11 and Plasma 5 enabled, as well as the VirtualBox guest additions. To
Expand All @@ -139,6 +142,7 @@
href="[%prefix%]/latest-nixos-x86_64-linux.ova.sha256">SHA-256</a>)</li>
</ul>
</section>

<section class="tab-pane" id="nixos-amazon">
<p>If you are an EC2 user, you can deploy a NixOS instance instantly
in your preferred region by using one of the AMIs listed below.</p>
Expand Down Expand Up @@ -182,112 +186,7 @@
<pre class="well">
$ ec2-run-instances [% ami %] --region [% region %] -k <em>my-key-pair</em></pre>
</section>
<section class="tab-pane" id="nixos-azure">
<p>If you are an Azure user, you can manually create a NixOS instance
by using one of the bootstrap BLOBs listed below.</p>

<div class="alert alert-block">
Please note that latest release currently lacks Azure image. We hope to
change this soon.
</div>

<div class="row">
<table class="table">
<thead>
<tr>
<th>NixOS version</th>
<th>BLOB URL</th>
</tr>
</thead>
<tbody>
[% blobs = JSON.Escape.json_decode(IO.All.new(nixosAzureBlobs).all) %]
[% FOREACH version IN blobs.keys.sort; blob = blobs.$version %]
<tr>
<td><code>[% version %]</code></td>
<td><a href="[% blob %]"><code>[% blob %]</code></a></td>
</tr>
[% END %]
</tbody>
</table>
</div>

<p>You can create an instance from the command line.
For example, to create an instance of version
<code>[% blob = blobs.$latestNixOSSeries; latestNixOSSeries %]</code>
of NixOS using azure-cli, just run:</p>

<pre class="well">
# settings
# vm name must be lowercase and letters/numbers only because it's also used as the domain name
export VM_NAME="nixosvm"
export RESOURCE_GROUP="rg-nixosvm"
export LOCATION="eastus"
export STORAGE_ACCOUNT="nixosvm"
export SOURCE_URI="<code>[% blob %]</code>"

# create group
az group create \
--name "$RESOURCE_GROUP" \
--location "$LOCATION

# create storage
az storage account create \
--name "$STORAGE_ACCOUNT" \
--group "$RESOURCE_GROUP" \
--location "$LOCATION" \
--sku Standard_LRS

az storage account keys list \
--name "$STORAGE_ACCOUNT" \
--group $RESOURCE_GROUP

# export one of the storage access keys
export STORAGE_ACCOUNT_KEY="..."
echo $STORAGE_ACCOUNT_KEY

az storage container create \
--account-name "$STORAGE_ACCOUNT"
--account-key "$STORAGE_ACCOUNT_KEY"
--name vm-images

# copy the image blob
az storage blob copy start \
--source-uri "$SOURCE_URI" \
--destination-blob "nixos-unstable-nixops.vhd" \
--destination-container "vm-images" \
--account-name "$STORAGE_ACCOUNT" \
--account-key "$STORAGE_ACCOUNT_KEY"

# wait for blob copy status to change pending->success
az storage blob show \
--name "nixos-unstable-nixops.vhd" \
--container-name "vm-images" \
--account-name "$STORAGE_ACCOUNT" \
--account-key "$STORAGE_ACCOUNT_KEY"


# create vm
az vm create \
--name "$VM_NAME" \
--resource-group "$RESOURCE_GROUP" \
--location "$LOCATION" \
--public-ip-address-dns-name "$VM_NAME" \
--image "https://$STORAGE_ACCOUNT.blob.core.windows.net/vm-images/nixos-unstable-nixops.vhd" \
--storage-account "$STORAGE_ACCOUNT" \
--storage-container-name "$VM_NAME" \
--use-unmanaged-disk \
--os-disk-size-gb "32" \
--os-type linux \
--admin-username "azureuser" \
--generate-ssh-keys

# show machine properties and log in
az vm show \
--name "$VM" \
--resource-group "$GROUP"

ssh azureuser@"$VM_NAME"."$LOCATION".cloudapp.azure.com</pre>
</section>
<section class="tab-pane" id="nixos-google">
<p>If you are Google Cloud Platform user, you can create a NixOS image using one of the raw disks listed below. You
can then create a NixOS instance using the image.</p>
Expand Down Expand Up @@ -326,6 +225,7 @@ source_uri=$(sed 's%gs:/%https://storage.googleapis.com%' &lt;&lt;&lt; $source_u
gcloud compute images create $image --source-uri=$source_uri
gcloud compute instances create instance-1 --image=$image</pre>
</section>

<section class="tab-pane" id="nixos-more">
<h2 id="unstable-releases">Unstable releases</h2>

Expand Down
31 changes: 18 additions & 13 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 17 additions & 20 deletions flake.nix
Expand Up @@ -3,39 +3,35 @@

description = "The nixos.org homepage";

inputs.nixpkgsStable.url = "nixpkgs/release-19.09";
inputs.nixpkgs.url = "nixpkgs/nixos-20.03";
inputs.nix-pills = { url = "github:NixOS/nix-pills"; flake = false; };

outputs = { self, nixpkgsStable, nix-pills }:
with import nixpkgsStable { system = "x86_64-linux"; };
outputs = { self, nixpkgs, nix-pills }:
with import nixpkgs { system = "x86_64-linux"; };
rec {

checks.x86_64-linux.build = defaultPackage.x86_64-linux;

packages.x86_64-linux = {

packagesExplorer = import ./packages-explorer nixpkgsStable;
packagesExplorer = import ./packages-explorer nixpkgs;

nixosAmis = writeText "ec2-amis.json"
(builtins.toJSON (
import (nixpkgsStable + "/nixos/modules/virtualisation/ec2-amis.nix")));

nixosAzureBlobs = writeText "azure-blobs.json"
(builtins.toJSON (
import (nixpkgsStable + "/nixos/modules/virtualisation/azure-bootstrap-blobs.nix")));
import (nixpkgs + "/nixos/modules/virtualisation/ec2-amis.nix")));

nixosGCE = writeText "gce-images.json"
(builtins.toJSON (
import (nixpkgsStable + "/nixos/modules/virtualisation/gce-images.nix")));
import (nixpkgs + "/nixos/modules/virtualisation/gce-images.nix")));

nixPills = import nix-pills {
inherit pkgs;
revCount = nix-pills.lastModified; # FIXME
revCount = nix-pills.lastModifiedDate; # FIXME
shortRev = nix-pills.shortRev;
};

homepage = stdenv.mkDerivation {
name = "nixos-homepage-${self.lastModified}";
name = "nixos-homepage-${self.lastModifiedDate}";

src = self;

Expand All @@ -50,6 +46,7 @@
perlPackages.TemplateToolkit
perlPackages.TemplatePluginJSONEscape
perlPackages.TemplatePluginIOAll
perlPackages.AppConfig
pkgs.nix
imagemagick
xhtml1
Expand All @@ -65,11 +62,10 @@

makeFlags =
[ "NIX_MANUAL_IN=${nix.doc}/share/doc/nix/manual"
"NIXOS_MANUAL_IN=${nixpkgsStable.htmlDocs.nixosManual}"
"NIXPKGS_MANUAL_IN=${nixpkgsStable.htmlDocs.nixpkgsManual}"
"NIXOS_MANUAL_IN=${nixpkgs.htmlDocs.nixosManual}"
"NIXPKGS_MANUAL_IN=${nixpkgs.htmlDocs.nixpkgsManual}"
"NIXOS_AMIS=${packages.x86_64-linux.nixosAmis}"
"NIXOS_GCE=${packages.x86_64-linux.nixosGCE}"
"NIXOS_AZURE_BLOBS=${packages.x86_64-linux.nixosAzureBlobs}"
"PACKAGES_EXPLORER=${packages.x86_64-linux.packagesExplorer}/bundle.js"
"NIX_PILLS_MANUAL_IN=${packages.x86_64-linux.nixPills}/share/doc/nix-pills"
];
Expand All @@ -81,11 +77,10 @@

shellHook = ''
export NIX_MANUAL_IN="${nix.doc}/share/doc/nix/manual"
export NIXOS_MANUAL_IN="${nixpkgsStable.htmlDocs.nixosManual}"
export NIXPKGS_MANUAL_IN="${nixpkgsStable.htmlDocs.nixpkgsManual}"
export NIXOS_MANUAL_IN="${nixpkgs.htmlDocs.nixosManual}"
export NIXPKGS_MANUAL_IN="${nixpkgs.htmlDocs.nixpkgsManual}"
export NIXOS_AMIS="${packages.x86_64-linux.nixosAmis}"
export NIXOS_GCE="${packages.x86_64-linux.nixosGCE}"
export NIXOS_AZURE_BLOBS="${packages.x86_64-linux.nixosAzureBlobs}"
export PACKAGES_EXPLORER="${packages.x86_64-linux.packagesExplorer}/bundle.js"
export NIX_PILLS_MANUAL_IN="${packages.x86_64-linux.nixPills}/share/doc/nix-pills"
'';
Expand All @@ -96,7 +91,7 @@

defaultPackage.x86_64-linux = packages.x86_64-linux.homepage;

nixosConfigurations.container = nixpkgsStable.lib.nixosSystem {
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
[ ({ lib, ... }:
Expand All @@ -107,7 +102,9 @@
services.httpd = {
enable = true;
adminAddr = "admin@example.org";
documentRoot = self.packages.x86_64-linux.homepage;
virtualHosts.default = {
documentRoot = self.packages.x86_64-linux.homepage;
};
};
})
];
Expand Down

0 comments on commit 4ebccef

Please sign in to comment.