Skip to content

Instantly share code, notes, and snippets.

@conklech
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conklech/bba5c73ebc153a6a411b to your computer and use it in GitHub Desktop.
Save conklech/bba5c73ebc153a6a411b to your computer and use it in GitHub Desktop.
Setting up a Haskell development environment with Nix and VirtualBox

This is for a Windows host.

See other material by ocharles, ocharles (new), Fūzetsu, Pavel Kogan.

See mailing list post on haskell-ng. This is still unresolved for me.

Acquire Virtualbox

Create a new VM

Give it two network adapters. Set one to "host only" and one to the default, "NAT". Do SSH connections over the host-only connection. The reason is that connections to the NAT machine are dropped when Windows goes to sleep.

Install NixOS

Don't follow the special instructions on the NixOS wiki; as of early 2015 they're wrong. Download an ISO, mount it in VBox, and follow the normal NixOS installation method.

$ fdisk /dev/sda # Create a full partition, For quick setup use these commands in order: n, p, 1, w
$ mkfs.ext4 -j -L nixos /dev/sda1
$ mount LABEL=nixos /mnt
$ nixos-generate-config --root /mnt
$ nano /mnt/etc/nixos/configuration.nix

Uncomment boot.loader.grub.device = "/dev/sda"; Do not add fileSystems stuff or virtualbox guest additions; that's in the hardware autodetect script.

users.mutableUsers = false;
users.extraUsers.christian = {
  isNormalUser = true;
  home = "/home/christian";
  extraGroups = [ "wheel" ];
  openssh.authorizedKeys.keys = [
    "ssh-rsa ..."
    ];
  uid = 1000;
};
security.sudo.wheelNeedsPassword = false;


$ nixos-install
$ reboot

Get the VM's IP address:

$ ip a

Configure PuTTY

Use PuTTY for SSH. Set up a connection profile. Set the auto-login username in the Connection>Data menu.

For decent colors, see solarized. Edit the profile name at the end of the registry key to the nixos profile; it'll just override the colors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment