Haskell development environment on Android phone
Install a full Haskell development environment (including hpack and cabal) on your Android phone. The command prompt runs via Termux and its PRoot (i.e. proot-distro).
F-Droid
Install F-Droid from f-droid.org (follow instructions).
Termux + PRoot
First install the Termux package via F-Droid and then follow the PRoot instructions to install a Linux distribution on your phone (I use Debian).
1pkg install proot
2pkg install proot-distro
3proot-distro install debian
After installation has completed use the following to get a Debian prompt:
1proot-distro login debian
Debian packages
A number of Debian packages are required and useful for your Haskell development environment. To install them start up Debian Linux under Termux (per instructions with PRoot) and type the following commands:
1apt-get update
2apt-get install build-essential curl vim-nox silversearcher-ag git ghc cabal-install hpack hlint stylish-haskell pkgconf libghc-zlib-dev libghc-text-icu-dev libpq-dev
Demonstration
Use the commands below to get and build my Paperspan export (HTML) to Instapaper import (CSV) convertor – Paperspan export (HTML) to Instapaper import (CSV) convertor.
1git clone https://github.com/maridonkers/paperspan2instapaper.git
2cd paperspan2instapaper
3cabal update
4hpack
5cabal build
6cp folders-example.yaml folders.yaml
7cabal run . -- yourpaperspanexportfile.html
Notes:
- Depending on your phone the
cabal new-update
andcabal new-build
may take a while to complete. - If the build fails then simply start it again (I had to start it again once).
Keys menu and colors
Configuration of useful keys in the keys menu and readable colors via Termux
configuration files.
Termux configuration
~/.termux/termux.properties
1### After making changes and saving you need to run `termux-reload-settings`
2### to update the terminal. All information here can also be found on the
3### wiki: https://wiki.termux.com/wiki/Terminal_Settings
4
5###############
6# General
7###############
8
9### Allow external applications to execute arbitrary commands within Termux.
10### This potentially could be a security issue, so option is disabled by
11### default. Uncomment to enable.
12# allow-external-apps = true
13
14### Default working directory that will be used when launching the app.
15# default-working-directory = /data/data/com.termux/files/home
16
17### Uncomment to disable toasts shown on terminal session change.
18# disable-terminal-session-change-toast = true
19
20### Uncomment to not show soft keyboard on application start.
21# hide-soft-keyboard-on-startup = true
22
23### Uncomment to let keyboard toggle button to enable or disable software
24### keyboard instead of showing/hiding it.
25# soft-keyboard-toggle-behaviour = enable/disable
26
27### Adjust terminal scrollback buffer. Max is 50000. May have negative
28### impact on performance.
29# terminal-transcript-rows = 2000
30
31### Uncomment to use volume keys for adjusting volume and not for the
32### extra keys functionality.
33# volume-keys = volume
34
35###############
36# Fullscreen mode
37###############
38
39### Uncomment to let Termux start in full screen mode.
40# fullscreen = true
41
42### Uncomment to attempt workaround layout issues when running in
43### full screen mode.
44# use-fullscreen-workaround = true
45
46###############
47# Cursor
48###############
49
50### Cursor blink rate. Values 0, 100 - 2000.
51# terminal-cursor-blink-rate = 0
52
53### Cursor style: block, bar, underline.
54# terminal-cursor-style = block
55
56###############
57# Extra keys
58###############
59
60### Settings for choosing which set of symbols to use for illustrating keys.
61### Choose between default, arrows-only, arrows-all, all and none
62# extra-keys-style = default
63
64### Force capitalize all text in extra keys row button labels.
65# extra-keys-text-all-caps = true
66
67### Default extra-key configuration
68#extra-keys = [[ESC, TAB, CTRL, SPACE, {key: '-', popup: '|'}, LEFT, DOWN, UP, RIGHT]]
69extra-keys = [[ESC, CTRL, TAB, '|', '/', '~', SPACE, LEFT, UP, DOWN, RIGHT]]
70
71### Two rows with more keys
72# extra-keys = [['ESC','/','-','HOME','UP','END','PGUP'], \
73# ['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN']]
74
75### Configuration with additional popup keys (swipe up from an extra key)
76# extra-keys = [[ \
77# {key: ESC, popup: {macro: "CTRL f d", display: "tmux exit"}}, \
78# {key: CTRL, popup: {macro: "CTRL f BKSP", display: "tmux ←"}}, \
79# {key: ALT, popup: {macro: "CTRL f TAB", display: "tmux →"}}, \
80# {key: TAB, popup: {macro: "ALT a", display: A-a}}, \
81# {key: LEFT, popup: HOME}, \
82# {key: DOWN, popup: PGDN}, \
83# {key: UP, popup: PGUP}, \
84# {key: RIGHT, popup: END}, \
85# {macro: "ALT j", display: A-j, popup: {macro: "ALT g", display: A-g}}, \
86# {key: KEYBOARD, popup: {macro: "CTRL d", display: exit}} \
87# ]]
88
89###############
90# Colors/themes
91###############
92
93### Force black colors for drawer and dialogs
94# use-black-ui = true
95use-black-ui = true
96
97###############
98# HW keyboard shortcuts
99###############
100
101### Disable hardware keyboard shortcuts.
102# disable-hardware-keyboard-shortcuts = true
103
104### Open a new terminal with ctrl + t (volume down + t)
105# shortcut.create-session = ctrl + t
106
107### Go one session down with (for example) ctrl + 2
108# shortcut.next-session = ctrl + 2
109
110### Go one session up with (for example) ctrl + 1
111# shortcut.previous-session = ctrl + 1
112
113### Rename a session with (for example) ctrl + n
114# shortcut.rename-session = ctrl + n
115
116###############
117# Bell key
118###############
119
120### Vibrate device (default).
121# bell-character = vibrate
122
123### Beep with a sound.
124# bell-character = beep
125
126### Ignore bell character.
127# bell-character = ignore
128
129###############
130# Back key
131###############
132
133### Send the Escape key.
134# back-key=escape
135
136### Hide keyboard or leave app (default).
137# back-key=back
138
139###############
140# Keyboard issue workarounds
141###############
142
143### Letters might not appear until enter is pressed on Samsung devices
144# enforce-char-based-input = true
145
146### ctrl+space (for marking text in emacs) does not work on some devices
147# ctrl-space-workaround = true
The color theme
~/.termux/colors.properties
1background: #000000
2foreground: #F8F8F2
3
4color0: #000000
5color8: #4D4D4D
6
7color1: #F1FA8C
8color9: #F4F99D
9
10color2: #50FA7B
11color10: #5AF78E
12
13color3: #F08080
14color11: #FF6E67
15
16color4: #8BE9FD
17color12: #9AEDFE
18
19color5: #FF79C6
20color13: #FF92D0
21
22color6: #BD93F9
23color14: #CAA9FA
24
25color7: #BFBFBF
26color15: #E6E6E6
Termux sessions
If you require additional command prompts then simply swipe in from the left of the Termux window, to get the menu.
Select NEW SESSION
in the menu.
OpenSSH and GUI
sshd
Modern phones are multi-core powerhouses with loads of memory and I've compiled big projects on my 2013 phone (a Samsung Note 3). The small on screen keyboard is a bit of a nuisance so you can run a SSH-server on your phone and ssh into it from a computer with a regular keyboard. Termux documentation is here: Remote Access.
GUI
You can also set up a graphical environment for your Termux installation, which enables you to run graphical programs from your termux prompt. Instructions here: Graphical Environment.
Screen dump