forked from cstrahan/nix-packer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packer-template.json
59 lines (58 loc) · 1.8 KB
/
packer-template.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
"variables": {
"swap_size": "",
"disk_size": "40000",
"memmory_size": "1024",
"cpus": "1",
"vm_name": "@VM_NAME@",
"iso_url": "@ISO_URL@",
"iso_checksum_type": "sha256",
"iso_checksum": "@ISO_CHECKSUM@",
"nixos_channel": "@NIXOS_CHANNEL@"
},
"builders": [
{
"type": "virtualbox-iso",
"vm_name": "{{ user `vm_name` }}",
"guest_os_type": "@GUEST_OS_TYPE@",
"disk_size": "{{ user `disk_size` }}",
"boot_wait": "0.7m",
"boot_command": [
"root<enter>",
"export HTTP_IP={{ .HTTPIP }}<enter>",
"export HTTP_PORT={{ .HTTPPort }}<enter>",
"export SWAP=\"{{ user `swap_size` }}\"<enter>",
"export NIXOS_CHANNEL=\"{{ user `nixos_channel` }}\"<enter>",
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/boot.sh -s > boot.sh<enter><wait>",
"sh boot.sh<enter><wait>"
],
"http_directory": "nixos",
"iso_url": "{{ user `iso_url` }}",
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
"iso_checksum": "{{ user `iso_checksum` }}",
"shutdown_command": "sudo shutdown -h now",
"ssh_username": "vagrant",
"ssh_key_path": "keys/vagrant.key",
"ssh_wait_timeout": "25m",
"virtualbox_version_file": ".vbox_version",
"guest_additions_mode": "disable",
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "{{ user `memmory_size` }}"],
["modifyvm", "{{.Name}}", "--cpus", "{{ user `cpus` }}"]
]
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "sudo -E sh '{{.Path}}'",
"script": "scripts/postinstall.sh"
}
],
"post-processors": [
{
"type": "vagrant",
"output": "@VM_NAME@-{{.Provider}}.box"
}
]
}