use custom nixpkgs and fix virtualbox

This commit is contained in:
Chris Farmiloe 2014-02-01 20:04:09 +00:00
parent f0d017a201
commit 27993a5f78
11 changed files with 107 additions and 127 deletions

View file

@ -1,27 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAr2QdWgfsKKXCPIjrPHZ0YRzsqEcIjj2Apg62qylsh4DPZ2tw
XV3mtJVj9QchOHoeDiD1l4jUeebmijkYGCi/NkiO3pl6mM6LvVhfWSaCu3tlEzwI
XLxLR5W+wGgUs+Tkxd3QTLuHCCKwu9mxH6luoH5iNuZ9ZcfP131DEX6xLIOKjenr
NbIb8famtiF4GhzjeQ/hTYCQk5vYxcI1+O5UOV3eyjVqo0b4WugdNMZERT5ZwyN2
rKWA1FumngCNsMh1demYj+ii/lxn6scOBHy9uTyLWrTt/H2U117XcK0jrGLSQTnY
Jqu1vlr/0Vp0xQgemPHZftm5OZPvVvwYWprsYwIDAQABAoIBAQCGMuMmfQNcgqAh
M15ScAxSNhB6HYfVVge2h3GLe3GYKJ4JcrKSLgQVTm0iEaeAkCepBd0EamSxNVRW
lKLz8VGFFnWCqwqcGwXfBdxG2WmUTDElS3zWgBhVmKVQkRKuJshJAZSc8au7NNfn
lASrxjdoQ+ugODHgi8djCWwk2bx04pexVh6k3iMtzQ3kF5aureh3PdTVqudpwGPy
BuRJeMSLCrYvJtJayoYoV/i4NpLYmXHCpGlZ2R+Ig+JdAX6C6Nf3vBrnyEksV/Rc
5ls2zN5bprJi5ESImQTAuweJUo3SvyWQU/4TtOu+taYMLgo9UBdSr4+g08fY4kiO
aITPwYpBAoGBAOfNfaa3K2f+pYztWD13dNq/M9ljl7oLEU7JT/Ft1JhF8578X5nc
7NGyQyWGMytZUQE7M7mnCJ0W1jLtoL9xrUap757eEQ4vHoOAFlOCfq3ccjjeICAr
WGe1ccZgV/RL8vtYR1wTBEAjcefk/eBMXkf0+8Al2hk9OdRdBq/ivcEDAoGBAMGz
H/XWrHC3IWY73rka4XYw2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o4pzVEhzWoTtnEtrFueKxyc3+LjZpuo+mBlQ6ORtfgkr9gBVphXZG
YEzkCD3lVdl8L4cw9BVpKrJCs1c5taGjDgdInQKBgHm/fVvv96bJxc9x1tffXAcj
3OVdUN0UgXNCSaf/3A/phbeBQe9xS+3mpc4r6qvx+iy69mNBeNZ0xOitIjpjBo2+
dBEjSBwLk5q5tJqHmy/jKMJL4n9ROlx93XS+njxgibTvU6Fp9w+NOFD/HvxB3Tcz
6+jJF85D5BNAG3DBMKBjAoGBAOAxZvgsKN+JuENXsST7F89Tck2iTcQIT8g5rwWC
P9Vt74yboe2kDT531w8+egz7nAmRBKNM751U/95P9t88EDacDI/Z2OwnuFQHCPDF
llYOUI+SpLJ6/vURRbHSnnn8a/XG+nzedGH5JGqEJNQsz+xT2axM0/W/CRknmGaJ
kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH
+vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ
NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s=
-----END RSA PRIVATE KEY-----

1
keys/vagrant.pub Normal file
View file

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key

View file

@ -1,34 +0,0 @@
{ config, pkgs, ... }:
#
# This file is only used for the inital install. It is a bare-bones
# system configuration with just grub and openssh.
#
# This file should be removed by the postinstall scripts.
#
{
imports =[ ./hardware-configuration.nix ];
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/sda";
# hostname
networking.hostName = "CycleSDK";
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.permitRootLogin = "yes";
users.extraUsers.root.openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCvZB1aB+wopcI8iOs8dnRhHOyoRwiOPYCmDrarKWyHgM9na3BdXea0lWP1ByE4eh4OIPWXiNR55uaKORgYKL82SI7emXqYzou9WF9ZJoK7e2UTPAhcvEtHlb7AaBSz5OTF3dBMu4cIIrC72bEfqW6gfmI25n1lx8/XfUMRfrEsg4qN6es1shvx9qa2IXgaHON5D+FNgJCTm9jFwjX47lQ5Xd7KNWqjRvha6B00xkRFPlnDI3aspYDUW6aeAI2wyHV16ZiP6KL+XGfqxw4EfL25PItatO38fZTXXtdwrSOsYtJBOdgmq7W+Wv/RWnTFCB6Y8dl+2bk5k+9W/Bhamuxj public@installkey" ];
# Enable DBus
services.dbus.enable = true;
# Default packages
environment.systemPackages = with pkgs; [
git
];
}

View file

@ -1,60 +1,26 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
#
# This file should only be a list of imports managed by whichever provisioner
# is building the environment.
#
# You should not be editing this by hand.
#
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./sdk.nix ./guest.nix
./vagrant.nix
]; ];
# Use the GRUB 2 boot loader. # we want our nixpkgs repo to take priority
boot.loader.grub.enable = true; environment.shellInit = ''
boot.loader.grub.version = 2; export NIX_PATH='nixpkgs=/etc/nixos/nixpkgs:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels/nixos'
boot.loader.grub.device = "/dev/sda"; '';
# hostname environment.systemPackages = with pkgs; [
networking.hostName = "CycleSDK";
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Virtualbox guest
services.virtualbox.enable = true;
# Enable DBus
services.dbus.enable = true;
# Default packages
environment.systemPackages = with pkgs; [
git git
]; ];
# Creates a "vagrant" users with password-less sudo access
users = {
extraGroups = [ { name = "vagrant"; } { name = "vboxsf"; } ];
extraUsers = [ {
description = "Vagrant User";
name = "vagrant";
group = "vagrant";
extraGroups = [ "users" "vboxsf" "wheel" ];
password = "vagrant";
home = "/home/vagrant";
createHome = true;
useDefaultShell = true;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
];
} ];
};
security.sudo.configFile = ''
Defaults:root,%wheel env_keep+=LOCALE_ARCHIVE
Defaults:root,%wheel env_keep+=NIX_PATH
Defaults:root,%wheel env_keep+=TERMINFO_DIRS
Defaults env_keep+=SSH_AUTH_SOCK
Defaults lecture = never
root ALL=(ALL) SETENV: ALL
%wheel ALL=(ALL) NOPASSWD: ALL, SETENV: ALL
'';
} }

View file

@ -0,0 +1,19 @@
{ config, pkgs, ... }:
#
# This file contains configuration specific to running OS as a virtualbox guest.
#
{
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/sda";
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.permitRootLogin = "yes";
users.extraUsers.root.openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" ];
}

View file

@ -1,5 +0,0 @@
{ config, pkgs, ... }:
{
# add sdk configure here
}

39
nixos/vagrant.nix Normal file
View file

@ -0,0 +1,39 @@
{ config, pkgs, ... }:
#
# This file configures the OS for use with vagrant by setting up the
# vagrant user, keys etc.
#
{
# Creates a "vagrant" users with password-less sudo access
users = {
extraGroups = [ { name = "vagrant"; } { name = "vboxsf"; } ];
extraUsers = [ {
description = "Vagrant User";
name = "vagrant";
group = "vagrant";
extraGroups = [ "users" "vboxsf" "wheel" ];
password = "vagrant";
home = "/home/vagrant";
createHome = true;
useDefaultShell = true;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
];
} ];
};
security.sudo.wheelNeedsPassword = false;
security.sudo.configFile = ''
Defaults:root,%wheel env_keep+=LOCALE_ARCHIVE
Defaults:root,%wheel env_keep+=NIX_PATH
Defaults:root,%wheel env_keep+=TERMINFO_DIRS
Defaults env_keep+=SSH_AUTH_SOCK
Defaults lecture = never
root ALL=(ALL) SETENV: ALL
%wheel ALL=(ALL) NOPASSWD: ALL, SETENV: ALL
'';
}

View file

@ -2,11 +2,9 @@
set -e set -e
# Switch to unstable channel # rebuild (which should now use our nixpkgs)
nix-channel --remove nixos nix-channel --remove nixos
nix-channel --add http://nixos.org/channels/nixos-unstable nixos nix-channel --add http://nixos.org/channels/nixos-unstable nixos
# Update and initialize our new configuration
nixos-rebuild switch --upgrade nixos-rebuild switch --upgrade
# Cleanup any previous generations and delete old packa # Cleanup any previous generations and delete old packa

View file

@ -16,8 +16,10 @@
"mkfs.ext4 -j -L nixos /dev/sda1<enter><wait5>", "mkfs.ext4 -j -L nixos /dev/sda1<enter><wait5>",
"mount LABEL=nixos /mnt<enter><wait>", "mount LABEL=nixos /mnt<enter><wait>",
"nixos-generate-config --root /mnt<enter><wait>", "nixos-generate-config --root /mnt<enter><wait>",
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/basic.nix > /mnt/etc/nixos/configuration.nix<enter><wait>", "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/configuration.nix > /mnt/etc/nixos/configuration.nix<enter><wait>",
"nixos-install && reboot<enter>" "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/guest-virtualbox.nix > /mnt/etc/nixos/guest.nix<enter><wait>",
"curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/vagrant.nix > /mnt/etc/nixos/vagrant.nix<enter><wait>",
"nix-env -i git && (cd /mnt/etc/nixos && git clone git://github.com/oxdi/nixpkgs.git) && nixos-install && reboot<enter>"
], ],
"guest_additions_mode": "disable", "guest_additions_mode": "disable",
"guest_os_type": "Linux_64", "guest_os_type": "Linux_64",
@ -27,8 +29,8 @@
"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/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_username": "root", "ssh_username": "root",
"ssh_key_path": "keys/install.key", "ssh_key_path": "keys/vagrant.key",
"ssh_wait_timeout": "10m", "ssh_wait_timeout": "20m",
"virtualbox_version_file": ".vbox_version", "virtualbox_version_file": ".vbox_version",
"vboxmanage": [ "vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "2048"], ["modifyvm", "{{.Name}}", "--memory", "2048"],
@ -37,11 +39,6 @@
} }
], ],
"provisioners": [ "provisioners": [
{
"type": "file",
"source": "nixos/",
"destination": "/etc/nixos"
},
{ {
"type": "shell", "type": "shell",
"execute_command": "sudo sh '{{.Path}}'", "execute_command": "sudo sh '{{.Path}}'",