Fixes for latest version of packer

This commit is contained in:
Chris Farmiloe 2014-01-29 12:47:06 +00:00
parent 6237b1ab53
commit 0221e9446d
6 changed files with 27 additions and 153 deletions

View file

@ -1,17 +0,0 @@
ISO_URL_32=http://nixos.org/releases/nixos/13.10/nixos-13.10.35455.45219b9/nixos-minimal-13.10.35455.45219b9-i686-linux.iso
ISO_MD5_32=c10f01734cb187e13068252e2cde565d
GUEST_OS_32=Linux
ISO_URL_64=http://nixos.org/releases/nixos/13.10/nixos-13.10.35455.45219b9/nixos-minimal-13.10.35455.45219b9-x86_64-linux.iso
ISO_MD5_64=fbac8c11661028e6f9c4ec293e1329e1
GUEST_OS_64=Linux_64
all: nixbox32-template.json nixbox64-template.json
nixbox32-template.json: nixbox-template.json.orig
cat $< | sed -e 's|ISO_URL|$(ISO_URL_32)|g' -e 's|ISO_MD5|$(ISO_MD5_32)|g' -e 's|GUEST_OS|$(GUEST_OS_32)|g' -e 's|NIXBOX|nixbox32|g' > $@
nixbox64-template.json: nixbox-template.json.orig
cat $< | sed -e 's|ISO_URL|$(ISO_URL_64)|g' -e 's|ISO_MD5|$(ISO_MD5_64)|g' -e 's|GUEST_OS|$(GUEST_OS_64)|g' -e 's|NIXBOX|nixbox64|g' > $@

View file

@ -1,45 +1,39 @@
NixOS boxes for Vagrant Base Cycle OS build scripts
======================= ===========================
[NixOS](http://nixos.org) is a linux distribution based on a purely functional Cycle's OS is based on [NixOS](http://nixos.org), a linux distribution with a purely functional
package manager. This project builds .box images that can be used by package manager.
[vagrant](http://vagrantup.com), the VM manager.
Status These scripts build .box images that can be used by [vagrant](http://vagrantup.com), the VM manager, and ISO images that can be installed on bare metal.
------
stable
Install
-------
```
vagrant box add nixbox32 http://zimbatm.s3.amazonaws.com/nixbox/nixos32-virtualbox.box
vagrant init nixbox32
# or
vagrant box add nixbox64 http://zimbatm.s3.amazonaws.com/nixbox/nixos64-virtualbox.box
vagrant init nixbox64
```
Building the images Building the images
------------------- -------------------
First install [packer](http://packer.io) and First install [packer](http://packer.io) and [virtualbox](https://www.virtualbox.org/)
[virtualbox](https://www.virtualbox.org/)
Then: Then:
``` ```
packer build nixbox32-template.json packer build cycle64-template.json
# or
packer build nixbox64-template.json
``` ```
The .box image is now ready to go and you can use it in vagrant: The .box image is now ready to go. Install it into Vagrant via:
``` ```
vagrant box add nixbox32 nixbox32-virtualbox.box vagrant box add cycle64 cycle64-virtualbox.box
# or ```
vagrant box add nixbox64-nixbox64-virtualbox.box
Running the images
------------------
To use the box with vagrant
```
cd /your/project/dir
vagrant init cycle64
vagrant up
vagrant ssh
``` ```

5
Vagrantfile vendored
View file

@ -2,8 +2,5 @@
# vi: set ft=ruby : # vi: set ft=ruby :
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = 'nixos32' config.vm.box = 'nixbox64'
config.vm.box_url = 'http://zimbatm.s3.amazonaws.com/nixbox/nixbox32-virtualbox.box'
#config.vm.box = 'nixos64'
#config.vm.box_url = 'http://zimbatm.s3.amazonaws.com/nixbox/nixbox64-virtualbox.box'
end end

View file

@ -1,7 +1,7 @@
{ {
"builders": [ "builders": [
{ {
"type": "virtualbox", "type": "virtualbox-iso",
"boot_wait": "1m", "boot_wait": "1m",
"boot_command": [ "boot_command": [
"root<enter>", "root<enter>",
@ -20,7 +20,7 @@
"nixos-install && reboot<enter>" "nixos-install && reboot<enter>"
], ],
"guest_additions_mode": "disable", "guest_additions_mode": "disable",
"guest_os_type": "Linux_64", "guest_os_type": "Gentoo_64",
"http_directory": "http", "http_directory": "http",
"iso_checksum": "fbac8c11661028e6f9c4ec293e1329e1", "iso_checksum": "fbac8c11661028e6f9c4ec293e1329e1",
"iso_checksum_type": "md5", "iso_checksum_type": "md5",
@ -29,7 +29,7 @@
"ssh_password": "vagrant", "ssh_password": "vagrant",
"ssh_port": 22, "ssh_port": 22,
"ssh_username": "vagrant", "ssh_username": "vagrant",
"ssh_wait_timeout": "5m", "ssh_wait_timeout": "10m",
"virtualbox_version_file": ".vbox_version" "virtualbox_version_file": ".vbox_version"
} }
], ],
@ -43,7 +43,7 @@
"post-processors": [ "post-processors": [
{ {
"type": "vagrant", "type": "vagrant",
"output": "nixbox64-{{.Provider}}.box" "output": "cycle64-{{.Provider}}.box"
} }
] ]
} }

View file

@ -1,50 +0,0 @@
{
"builders": [
{
"type": "virtualbox",
"boot_wait": "1m",
"boot_command": [
"root<enter>",
"stop sshd<enter>",
"fdisk /dev/sda<enter>",
"n",
"<enter><enter><enter><enter><enter>",
"a<enter>",
"1<enter>",
"w<enter>",
"<wait>",
"mkfs.ext4 -j -L nixos /dev/sda1<enter><wait5>",
"mount LABEL=nixos /mnt<enter><wait>",
"nixos-generate-config --root /mnt<enter><wait>",
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/configuration.nix | sed -e 's|nixbox|NIXBOX|g' > /mnt/etc/nixos/configuration.nix<enter><wait>",
"nixos-install && reboot<enter>"
],
"guest_additions_mode": "disable",
"guest_os_type": "GUEST_OS",
"http_directory": "http",
"iso_checksum": "ISO_MD5",
"iso_checksum_type": "md5",
"iso_url": "ISO_URL",
"shutdown_command": "sudo shutdown -h now",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_username": "vagrant",
"ssh_wait_timeout": "5m",
"virtualbox_version_file": ".vbox_version"
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "sudo sh '{{.Path}}'",
"script": "scripts/postinstall.sh"
}
],
"post-processors": [
{
"type": "vagrant",
"output": "NIXBOX-{{.Provider}}.box"
}
]
}

View file

@ -1,50 +0,0 @@
{
"builders": [
{
"type": "virtualbox",
"boot_wait": "1m",
"boot_command": [
"root<enter>",
"stop sshd<enter>",
"fdisk /dev/sda<enter>",
"n",
"<enter><enter><enter><enter><enter>",
"a<enter>",
"1<enter>",
"w<enter>",
"<wait>",
"mkfs.ext4 -j -L nixos /dev/sda1<enter><wait5>",
"mount LABEL=nixos /mnt<enter><wait>",
"nixos-generate-config --root /mnt<enter><wait>",
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/configuration.nix | sed -e 's|nixbox|nixbox32|g' > /mnt/etc/nixos/configuration.nix<enter><wait>",
"nixos-install && reboot<enter>"
],
"guest_additions_mode": "disable",
"guest_os_type": "Linux",
"http_directory": "http",
"iso_checksum": "c10f01734cb187e13068252e2cde565d",
"iso_checksum_type": "md5",
"iso_url": "http://nixos.org/releases/nixos/13.10/nixos-13.10.35455.45219b9/nixos-minimal-13.10.35455.45219b9-i686-linux.iso",
"shutdown_command": "sudo shutdown -h now",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_username": "vagrant",
"ssh_wait_timeout": "5m",
"virtualbox_version_file": ".vbox_version"
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "sudo sh '{{.Path}}'",
"script": "scripts/postinstall.sh"
}
],
"post-processors": [
{
"type": "vagrant",
"output": "nixbox32-{{.Provider}}.box"
}
]
}