forked from system-f/fp-course
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
240 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Vagrant.configure("2") do |config| | ||
config.vm.box = "ubuntu/xenial64" | ||
|
||
config.vm.provider 'virtualbox' do |vbox| | ||
vbox.memory = 4096 | ||
vbox.cpus = 2 | ||
vbox.gui = true | ||
end | ||
|
||
config.vm.provision 'ansible' do |ansible| | ||
ansible.playbook = 'ops/ansible.yaml' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Vagrant Box | ||
|
||
If you'd rather use a pre-configured haskell development environment, then these instructions will | ||
get you up and running in a VirtualBox virtual machine. The machine includes: | ||
|
||
- A Xubuntu desktop environment | ||
- GHC 8.0.2 installed | ||
- doctest | ||
- emacs with haskell-mode | ||
- vim | ||
- sublime | ||
- VS Code | ||
|
||
**NOTE**: The VM's default user is `ubuntu` and their password is `ubuntu` | ||
|
||
**WARNING**: Building the environment might take a while and download gigabytes of pacakges over the internet. | ||
|
||
## Prerequisites | ||
|
||
- Install [VirtualBox](https://www.virtualbox.org/) | ||
- Install [Vagrant](https://www.vagrantup.com/) | ||
- Install [ansible](https://www.ansible.com/) | ||
|
||
## Make it so | ||
|
||
The following will download a VM image of Ubuntu and then provision it to build a desktop | ||
environment for Haskell development. Once it's provisioned, reload the machine, which will log you | ||
straight into a graphical environment. | ||
|
||
``` | ||
cd fp-course | ||
vagrant up | ||
# go have lunch - this could take a while | ||
vagrant reload | ||
``` | ||
|
||
You should now see a virtual machine running Xubuntu. The course materials are checked out to | ||
`~/fp-course` and you should have all required binaries on your PATH. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
- name: "Install ansible deps (Python 2.7 stuff)" | ||
hosts: all | ||
user: ubuntu | ||
gather_facts: false | ||
tasks: | ||
- name: "Install ansible requirements" | ||
raw: apt-get update && apt-get install -y python2.7 python-simplejson | ||
become: yes | ||
|
||
- name: "Setup Ubuntu 16.04" | ||
hosts: all | ||
user: ubuntu | ||
|
||
tasks: | ||
- name: "Set ubuntu user's password to 'ubuntu'" | ||
user: | ||
name: ubuntu | ||
password: $6$hVCglTDqXKLR45$b4M1N30zbQmieXbHpqm3z1yYCZKNq1jF554WU7AwiBI/z8DkbV1zyE.aYeZvOkCgxsWIJv63IBEwB9riNmdyY/ | ||
become: yes | ||
|
||
- name: "Install packages" | ||
apt: | ||
name: "{{ item }}" | ||
update_cache: yes | ||
state: present | ||
become: yes | ||
with_items: | ||
- emacs | ||
- git | ||
- vim | ||
- xubuntu-desktop | ||
- virtualbox-guest-x11 | ||
|
||
- name: "Automatically login as ubuntu user" | ||
lineinfile: | ||
line: autologin-user=ubuntu | ||
dest: /usr/share/lightdm/lightdm.conf.d/60-xubuntu.conf | ||
become: yes | ||
|
||
- name: "Checkout course repo" | ||
git: | ||
repo: https://github.com/data61/fp-course | ||
dest: ~/fp-course | ||
|
||
- include: haskell.yaml | ||
- include: vs-code.yaml | ||
- include: sublime.yaml | ||
|
||
- name: "Copy emacs.d" | ||
copy: | ||
src: emacs.d/ | ||
dest: ~/.emacs.d/ | ||
mode: 0755 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
;; Pull in Marmalade packages | ||
(require 'package) | ||
(add-to-list 'package-archives | ||
'("marmalade" . "http://marmalade-repo.org/packages/")) | ||
(add-to-list 'package-archives | ||
'("melpa" . "http://melpa.milkbox.net/packages/")) | ||
(package-initialize) | ||
|
||
;; Ensure our preferred packages are all loaded in this install - taken from | ||
;; http://batsov.com/articles/2012/02/19/package-management-in-emacs-the-good-the-bad-and-the-ugly/ | ||
(defvar my-packages | ||
'(markdown-mode | ||
auto-complete | ||
haskell-mode) | ||
"A list of packages to ensure are installed at launch.") | ||
|
||
(require 'cl) | ||
(defun my-packages-installed-p () | ||
(loop for p in my-packages | ||
when (not (package-installed-p p)) do (return nil) | ||
finally (return t))) | ||
|
||
(unless (my-packages-installed-p) | ||
;; check for new packages (package versions) | ||
(message "%s" "Emacs is now refreshing its package database...") | ||
(package-refresh-contents) | ||
(message "%s" " done.") | ||
;; install the missing packages | ||
(dolist (p my-packages) | ||
(when (not (package-installed-p p)) | ||
(package-install p)))) | ||
|
||
;; Show column numbers in mode line | ||
(column-number-mode t) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
|
||
- name: Add ghc PPA | ||
apt_repository: | ||
repo: ppa:hvr/ghc | ||
become: yes | ||
|
||
- name: Install ghc-8.0.2 | ||
apt: | ||
name: "{{ item }}" | ||
update_cache: yes | ||
state: present | ||
with_items: | ||
- ghc-8.0.2 | ||
- cabal-install-1.24 | ||
become: yes | ||
|
||
- name: Add cabal bin directory to PATH | ||
lineinfile: | ||
line: export PATH="{{ ansible_env.HOME }}/.cabal/bin:$PATH" | ||
dest: ~/.profile | ||
|
||
- name: Add /opt/ghc/bin to the path | ||
lineinfile: | ||
line: export PATH=/opt/ghc/bin:$PATH | ||
dest: ~/.profile | ||
|
||
- name: Update cabal | ||
command: cabal update | ||
environment: | ||
PATH: "/opt/ghc/bin:{{ ansible_env.PATH }}" | ||
|
||
- name: Insall cabal packages | ||
command: cabal install doctest | ||
environment: | ||
PATH: "/opt/ghc/bin:{{ ansible_env.PATH }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
- name: "Check if Sublime installed" | ||
command: which subl | ||
ignore_errors: true | ||
register: haz_sublime | ||
|
||
- name: "Add apt key for sublime" | ||
apt_key: | ||
url: https://download.sublimetext.com/sublimehq-pub.gpg | ||
state: present | ||
become: yes | ||
when: haz_sublime|failed | ||
|
||
- name: "Add source for sublime" | ||
apt_repository: | ||
repo: deb https://download.sublimetext.com/ apt/stable/ | ||
state: present | ||
become: yes | ||
when: haz_sublime|failed | ||
|
||
- name: "Install sublime" | ||
apt: | ||
name: sublime-text | ||
update_cache: yes | ||
state: present | ||
become: yes | ||
when: haz_sublime|failed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
- name: "Check if VS Code is installed" | ||
command: which code | ||
ignore_errors: true | ||
register: haz_code | ||
|
||
- name: "Download VS code" | ||
get_url: | ||
url: https://go.microsoft.com/fwlink/?LinkID=760868 | ||
dest: /tmp/vs-code.deb | ||
when: haz_code|failed | ||
|
||
# So the recommended install method is to install a thing with broken/missing | ||
# dependencies, and then fix it. | ||
- name: "Install VS Code deb" | ||
command: dpkg -i /tmp/vs-code.deb | ||
become: yes | ||
ignore_errors: true | ||
when: haz_code|failed | ||
|
||
- name: "Fix VS code installation" | ||
command: apt-get install -fy | ||
become: yes | ||
when: haz_code|failed | ||
|
||
- name: "Install haskell syntax highlighting for VS Code" | ||
command: code --install-extension justusadam.language-haskell |