keep the os closer to nixos and move custom bits into the sdk (at least for now)
This commit is contained in:
parent
8dcbbfe1f4
commit
e3e592ca9c
18
README.md
18
README.md
|
@ -1,10 +1,10 @@
|
||||||
Cycle OS build scripts
|
OS Image build scripts
|
||||||
======================
|
======================
|
||||||
|
|
||||||
Cycle's OS is based on [NixOS](http://nixos.org), a linux distribution with a purely functional
|
Cycle's OS is based on [NixOS](http://nixos.org), a linux distribution with a purely functional
|
||||||
package manager.
|
package manager.
|
||||||
|
|
||||||
These scripts build .box images that can be used by [vagrant](http://vagrantup.com), and ISO images that can be installed on bare metal.
|
These scripts build .box images that can be used by [vagrant](http://vagrantup.com) for development, and other images suitable for production.
|
||||||
|
|
||||||
See [CycleSDK](https://bitbucket.org/oxdi/cycle-sdk) for the complete development environment (which makes use of the images generated here).
|
See [CycleSDK](https://bitbucket.org/oxdi/cycle-sdk) for the complete development environment (which makes use of the images generated here).
|
||||||
|
|
||||||
|
@ -16,31 +16,27 @@ First install [packer](http://packer.io) and [virtualbox](https://www.virtualbox
|
||||||
|
|
||||||
Then:
|
Then:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
packer build template.json
|
packer build template.json
|
||||||
```
|
```
|
||||||
|
|
||||||
The .box image is now ready to go. Install it into Vagrant via:
|
The .box image is now ready to go. Install it into Vagrant via:
|
||||||
|
|
||||||
```
|
|
||||||
vagrant box add cycle64 cycle64-virtualbox.box
|
|
||||||
```
|
|
||||||
|
|
||||||
Updating the public box image
|
Updating the public box image
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
`s3put` is handy command line wrapper for copying files to Amazon S3, it's part of the [boto](https://github.com/boto/boto) library.
|
`s3put` is handy tool for copying files to Amazon S3, it's part of the [boto](https://github.com/boto/boto) library.
|
||||||
|
|
||||||
Install boto:
|
Install boto:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
pip install boto
|
pip install boto
|
||||||
```
|
```
|
||||||
|
|
||||||
Push the .box image to S3 via s3put
|
Push the .box image to S3 via s3put
|
||||||
|
|
||||||
```
|
```bash
|
||||||
s3put -a $AWS_ID -s $AWS_KEY -b oxdi -g public-read --prefix `pwd` cycle64-virtualbox.box
|
s3put -a $AWS_ID -s $AWS_KEY -b oxdi -g public-read --prefix `pwd` cycle-xx.xx-x86_64-virtualbox.box
|
||||||
```
|
```
|
||||||
|
|
||||||
The box will then be available at http://amazonaws.com/oxdi/cycle64-virtualbox.box
|
The box will then be available at http://amazonaws.com/oxdi/cycle64-virtualbox.box
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ./hardware-configuration.nix ];
|
imports = [
|
||||||
|
./hardware-configuration.nix
|
||||||
|
./sdk.nix
|
||||||
|
];
|
||||||
|
|
||||||
# Use the GRUB 2 boot loader.
|
# Use the GRUB 2 boot loader.
|
||||||
boot.loader.grub.enable = true;
|
boot.loader.grub.enable = true;
|
||||||
|
@ -14,7 +17,7 @@
|
||||||
# Enable the OpenSSH daemon.
|
# Enable the OpenSSH daemon.
|
||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
|
|
||||||
# Virtualbox guess
|
# Virtualbox guest
|
||||||
services.virtualbox.enable = true;
|
services.virtualbox.enable = true;
|
||||||
|
|
||||||
# Enable DBus
|
# Enable DBus
|
||||||
|
@ -35,8 +38,6 @@
|
||||||
# Default packages
|
# Default packages
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
git
|
git
|
||||||
subversion
|
|
||||||
vim
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# Creates a "vagrant" users with password-less sudo access
|
# Creates a "vagrant" users with password-less sudo access
|
||||||
|
|
5
nixos/sdk.nix
Normal file
5
nixos/sdk.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# add sdk configure here
|
||||||
|
}
|
|
@ -2,22 +2,11 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Checkout our nixpkg tree
|
|
||||||
git config --global http.sslVerify false
|
|
||||||
NIXREPO=/etc/nixos
|
|
||||||
# (cd $NIXREPO && git clone http://github.com/oxdi/nixpkgs.git)
|
|
||||||
|
|
||||||
# Update and initialize our new configuration
|
# Update and initialize our new configuration
|
||||||
# nixos-rebuild -I nixos=$NIXREPO/nixpkgs/nixos -I nixpkgs=$NIXREPO/nixpkgs switch
|
nix-channel --remove nixos
|
||||||
nixos-rebuild switch
|
nix-channel --add http://nixos.org/channels/nixos-unstable nixos
|
||||||
|
nixos-rebuild switch --upgrade
|
||||||
|
|
||||||
# Cleanup any previous generations and delete old packages that can be
|
# Cleanup any previous generations and delete old packa
|
||||||
# pruned.
|
|
||||||
for x in `seq 0 2` ; do
|
|
||||||
nix-env --delete-generations old
|
|
||||||
nix-collect-garbage -d
|
nix-collect-garbage -d
|
||||||
done
|
|
||||||
|
|
||||||
# Zero out the disk (for better compression)
|
|
||||||
# dd if=/dev/zero of=/EMPTY bs=1M
|
|
||||||
# rm -rf /EMPTY
|
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
"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": "e6193d70d283d05795cb07422689d1cd",
|
||||||
"iso_checksum_type": "md5",
|
"iso_checksum_type": "md5",
|
||||||
"iso_url": "http://releases.nixos.org/nixos/unstable/nixos-14.02pre38596.1dd0e05/nixos-minimal-14.02pre38596.1dd0e05-x86_64-linux.iso",
|
"iso_url": "http://releases.nixos.org/nixos/13.10/nixos-13.10.35608.1e7192a/nixos-minimal-13.10.35608.1e7192a-x86_64-linux.iso",
|
||||||
"shutdown_command": "sudo shutdown -h now",
|
"shutdown_command": "sudo shutdown -h now",
|
||||||
"ssh_username": "root",
|
"ssh_username": "root",
|
||||||
"ssh_key_path": "keys/install.key",
|
"ssh_key_path": "keys/install.key",
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
"post-processors": [
|
"post-processors": [
|
||||||
{
|
{
|
||||||
"type": "vagrant",
|
"type": "vagrant",
|
||||||
"output": "cycle64-{{.Provider}}.box"
|
"output": "cycle-13.10-x86_64-{{.Provider}}.box"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue