forked from github

This commit is contained in:
Anish Lakhwara 2022-07-15 01:49:53 +10:00
parent dbf26f58dd
commit ac758cf494
3 changed files with 90 additions and 23 deletions

View file

@ -12,6 +12,10 @@ Building the images
First install [packer](http://packer.io) and [virtualbox](https://www.virtualbox.org/) First install [packer](http://packer.io) and [virtualbox](https://www.virtualbox.org/)
```bash
nix-shell -p packer
```
Then: Then:
```bash ```bash

View file

@ -1,11 +1,7 @@
{ {
"builders": [ "builders": [
{ {
"type": "virtualbox-iso",
"boot_wait": "1m",
"boot_command": [ "boot_command": [
"root<enter>",
"stop sshd<enter>",
"fdisk /dev/sda<enter>", "fdisk /dev/sda<enter>",
"n", "n",
"<enter><enter><enter><enter><enter>", "<enter><enter><enter><enter><enter>",
@ -20,36 +16,47 @@
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/guest-virtualbox.nix > /mnt/etc/nixos/guest.nix<enter><wait>", "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/guest-virtualbox.nix > /mnt/etc/nixos/guest.nix<enter><wait>",
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/users-vagrant.nix > /mnt/etc/nixos/users.nix<enter><wait>", "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/users-vagrant.nix > /mnt/etc/nixos/users.nix<enter><wait>",
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/vagrant.nix > /mnt/etc/nixos/vagrant.nix<enter><wait>", "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/vagrant.nix > /mnt/etc/nixos/vagrant.nix<enter><wait>",
"nixos-install && reboot<enter>" "nixos-install \u0026\u0026 reboot<enter>"
], ],
"boot_wait": "1m",
"guest_additions_mode": "disable", "guest_additions_mode": "disable",
"guest_os_type": "Linux_64", "guest_os_type": "Linux_64",
"http_directory": "nixos", "http_directory": "nixos",
"iso_checksum": "48395b4bd21675703c87cfae1feb68ed", "iso_checksum": "sha256:aa9eeb04a491a84036368a93545400d79d16d281d4b7a29979bbb4f8476f9b81",
"iso_checksum_type": "md5", "iso_url": "https://releases.nixos.org/nixos/22.05/nixos-22.05.1700.365e1b3a859/nixos-minimal-22.05.1700.365e1b3a859-x86_64-linux.iso",
"iso_url": "http://releases.nixos.org/nixos/unstable/nixos-14.02pre38596.1dd0e05/nixos-minimal-14.02pre38596.1dd0e05-x86_64-linux.iso",
"shutdown_command": "sudo shutdown -h now", "shutdown_command": "sudo shutdown -h now",
"ssh_private_key_file": "keys/vagrant.key",
"ssh_timeout": "20m",
"ssh_username": "root", "ssh_username": "root",
"ssh_key_path": "keys/vagrant.key", "type": "virtualbox-iso",
"ssh_wait_timeout": "20m",
"virtualbox_version_file": ".vbox_version",
"vboxmanage": [ "vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "1024"], [
["modifyvm", "{{.Name}}", "--cpus", "2"] "modifyvm",
] "{{.Name}}",
} "--memory",
"1024"
], ],
"provisioners": [ [
{ "modifyvm",
"type": "shell", "{{.Name}}",
"execute_command": "sudo sh '{{.Path}}'", "--cpus",
"script": "scripts/postinstall.sh" "2"
]
],
"virtualbox_version_file": ".vbox_version"
} }
], ],
"post-processors": [ "post-processors": [
{ {
"type": "vagrant", "output": "nixos-22.05-x86_64-{{.Provider}}.box",
"output": "nixos-14.02-x86_64-{{.Provider}}.box" "type": "vagrant"
}
],
"provisioners": [
{
"execute_command": "sudo sh '{{.Path}}'",
"script": "scripts/postinstall.sh",
"type": "shell"
} }
] ]
} }

56
template.json.bak Normal file
View file

@ -0,0 +1,56 @@
{
"builders": [
{
"type": "virtualbox-iso",
"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 > /mnt/etc/nixos/configuration.nix<enter><wait>",
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/guest-virtualbox.nix > /mnt/etc/nixos/guest.nix<enter><wait>",
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/users-vagrant.nix > /mnt/etc/nixos/users.nix<enter><wait>",
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/vagrant.nix > /mnt/etc/nixos/vagrant.nix<enter><wait>",
"nixos-install && reboot<enter>"
],
"guest_additions_mode": "disable",
"guest_os_type": "Linux_64",
"http_directory": "nixos",
"iso_checksum": "aa9eeb04a491a84036368a93545400d79d16d281d4b7a29979bbb4f8476f9b81",
"iso_checksum_type": "sha256",
"iso_url": "https://releases.nixos.org/nixos/22.05/nixos-22.05.1700.365e1b3a859/nixos-minimal-22.05.1700.365e1b3a859-x86_64-linux.iso",
"shutdown_command": "sudo shutdown -h now",
"ssh_username": "root",
"ssh_key_path": "keys/vagrant.key",
"ssh_wait_timeout": "20m",
"virtualbox_version_file": ".vbox_version",
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "1024"],
["modifyvm", "{{.Name}}", "--cpus", "2"]
]
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "sudo sh '{{.Path}}'",
"script": "scripts/postinstall.sh"
}
],
"post-processors": [
{
"type": "vagrant",
"output": "nixos-22.05-x86_64-{{.Provider}}.box"
}
]
}