From b8843dd22575c8b0b2d2a56795e92ac7817824a0 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Wed, 27 Nov 2013 20:11:51 +0000 Subject: [PATCH] Working ! --- Makefile | 17 ++++++++++++++++ nixos-template.json.orig | 44 ++++++++++++++++++++++++++++++++++++++++ nixos32-template.json | 2 +- nixos64-template.json | 4 ++-- 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 Makefile create mode 100644 nixos-template.json.orig diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c1922a0 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ + +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: nixos32-template.json nixos64-template.json + +nixos32-template.json: nixos-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' > $@ + +nixos64-template.json: nixos-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' > $@ + diff --git a/nixos-template.json.orig b/nixos-template.json.orig new file mode 100644 index 0000000..032c47f --- /dev/null +++ b/nixos-template.json.orig @@ -0,0 +1,44 @@ +{ + "builders": [ + { + "type": "virtualbox", + "boot_wait": "1m", + "boot_command": [ + "root", + "stop sshd", + "fdisk /dev/sda", + "n", + "", + "a", + "1", + "w", + "", + "mkfs.ext4 -j -L nixos /dev/sda1", + "mount LABEL=nixos /mnt", + "nixos-generate-config --root /mnt", + "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/configuration.nix > /mnt/etc/nixos/configuration.nix", + "nixos-install && reboot" + ], + "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" + } + ] +} + diff --git a/nixos32-template.json b/nixos32-template.json index ffb60d8..314eb49 100644 --- a/nixos32-template.json +++ b/nixos32-template.json @@ -36,7 +36,7 @@ "provisioners": [ { "type": "shell", - "execute_command": "sudo '{{.Path}}'", + "execute_command": "sudo sh '{{.Path}}'", "script": "scripts/postinstall.sh" } ] diff --git a/nixos64-template.json b/nixos64-template.json index 929090b..dd7b3e5 100644 --- a/nixos64-template.json +++ b/nixos64-template.json @@ -13,7 +13,7 @@ "1", "w", "", - "mkfs.ext4 -j -L nixos /dev/sda1", + "mkfs.ext4 -j -L nixos /dev/sda1", "mount LABEL=nixos /mnt", "nixos-generate-config --root /mnt", "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/configuration.nix > /mnt/etc/nixos/configuration.nix", @@ -36,7 +36,7 @@ "provisioners": [ { "type": "shell", - "execute_command": "sudo '{{.Path}}'", + "execute_command": "sudo sh '{{.Path}}'", "script": "scripts/postinstall.sh" } ]