/nix-packer

This is a Packer definition for NixOS. It builds a Vagrant box for NixOS 14.04 x86_64.

Primary LanguageRuby

About

This is a Packer definition for NixOS. It builds a Vagrant box for NixOS 14.04 x86_64.

Usage

Pre-built boxes are hosted on VagrantCloud. To use a pre-built box, you just need to set the config.vm.box setting in your Vagrantfile to "cstrahan/nixos-14.04-x86_64". Here's a complete example:

Vagrant.configure("2") do |config|
  config.vm.box         = "cstrahan/nixos-14.04-x86_64"
  config.vm.box_version = "~> 0.1.0"

  config.ssh.forward_agent = true

  config.vm.provider "virtualbox" do |v|
    v.memory = 4000
    v.gui = false
  end
end

Building

If you want to customize the box, there are a couple variables you can pass to Packer:

  • swap_size - The size of the swap partition in megabytes. If this is empty (the default), no swap partition is created.
  • disk_size - The total size of the hard disk in megabytes (defaults to 40000).

There are also a couple variables that only effect the build:

  • memmory_size - The amount of RAM in megabytes (defaults to 1024).
  • cpus - The number of CPUs (defaults to 1).

Example:

$ packer build            \
    -var 'cpus=2'         \
    -var 'swap_size=2000' \
    nixos-14.04-x86_64.json