Giter Club home page Giter Club logo

nixos-cloud-image's Introduction

nixos-cloud-image

Disk image for an OpenStack-based cloud. Up to NixOS 16.09, there was no working cloud-init Module. The branch nixos-16.09 builds a cloud image for those NixOS versions. The tricky part is to integrate the customization in manner that still allows the image to use the standard NixOS channel.

Most of the required changes have been upstreamed to 17.03, but not all of them. The branch nixos-17.03 builds an image for that version.

Starting with 17.09, NixOS can create a working cloud image out of the box. The master branch of this repository now only contains a customization of the default cloud-init configuration, which essentially only adds a user nixos for initial access with full sudo privileges (root login is not permitted). It also creates a raw image instead of qcow2.

By default, the image uses the newest kernel available in the NixOS distribution defined by the package linuxPackages_latest. This can be changed by setting the argument kernelLatest of the default Nix expression to false, i.e. with nix-build --arg kernelLatest false. In that case, the kernel is defined by the package linuxPackages.

On a running instance, the kernel can be selected by setting the option boot.kernelPackages in /etc/nixos/cloud-config.nix.

Usage

To create an image, run

$ NIX_PATH=<path-to-nixpkgs> nix-build

in the cloned repository, where <path-to-nixpkgs> is the path to an instance of the nixpkgs distribution for which you want to build the image (must be at least 17.09). For example:

$ git clone https://github.com/alexandergall/nixos-cloud-image.git
$ cd nixos-cloud-image
$ git clone https://github.com/NixOS/nixpkgs.git
$ cd nixpkgs
$ git checkout release-17.09
$ cd ..
$ NIX_PATH=`pwd` nix-build

To use the default kernel of the distribution, execute

$ NIX_PATH=`pwd` nix-build --arg kernelLatest false

The size of the image is 1GiB by default. A different size can be selected by setting the diskSize parameter (in units of MiB), e.g.

$ NIX_PATH=`pwd` nix-build --arg diskSize 2048

After a successful build, the current directory contains a symlink result which points to the location in the Nix store where the disk image is stored.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.