一邊逃避工作一邊把讀 code 機裝好，繼續和 stack, xmonad 打架。

這次升級 Arch 後剛好遇上 `ld` 一直要求加上 `-fPIC` 的錯誤。但是文件中的 [I get strange ld errors about recompiling with "-fPIC"
][fPIC] 幫不上忙。安裝 AUR 上的 `ncurses5-compat-libs` 也無法解決此問題。

踩到的其實是 [Stack 1.6 linking issues on Arch Linux][linking-issues] 。

解法是使用 [stack-setup-2: nopie fixes for Arch, Gentoo, and Void Linux][stack-setup-2] 中的 yaml 。從檔案中可以看到， GHC 7 到 GHC 8.0.1 都被拿掉，所以得換掉包含這些 GHC 版本的 resolver ，例如 lts-7.9 。

`stack setup` 時，使用自訂 yaml 的方法是：

```
stack setup --setup-info-yaml=https://raw.githubusercontent.com/fpco/stackage-content/nopie-fixes-arch-gentoo/stack/stack-setup-2.yaml
```

等該 PR merge 後，才能把 `--setup-info-yaml` 拿掉。

[fPIC]: https://docs.haskellstack.org/en/stable/faq/#i-get-strange-ld-errors-about-recompiling-with-fpic
[linking-issues]: https://github.com/commercialhaskell/stack/issues/3518
[stack-setup-2]: https://github.com/fpco/stackage-content/pull/34

---

既然用 stack ，就跟 C 一樣連 xmonad 也用 stack 裝吧。

參考 [How to install xmonad and xmobar via stack][stack-xmonad-xmobar] ：

1. 建立一個直接用到 GitHub 上的 xmonad, xmonad-contrib, xmobar 的 stack 專案
1. 從該專案建置與安裝 xmonad 與 xmobar （`stack install`）
1. 利用 xmonad 0.13 後支援自訂 build script 這功能，讓 `xmonad --recompile` 時可以叫 stack 做事

未來修改 `.xmonad/xmonad.hs` 後只要：

```
xmonad --recompile && xmonad --restart
```

更新 xmonad 等 GitHub repos 時才需要：

```
stack install
```

[stack-xmonad-xmobar]: http://brianbuccola.com/how-to-install-xmonad-and-xmobar-via-stack/

---

最後準備好 `.xinitrc` 、安裝 [simple terminal][st] 、

交換 Control 和 CapsLock ：

```
xmodmap -e 'remove Lock = Caps_Lock'
xmodmap -e 'remove Control = Control_L'
xmodmap -e 'keysym Control_L = Caps_Lock'
xmodmap -e 'keysym Caps_Lock = Control_L'
xmodmap -e 'add Lock = Caps_Lock'
xmodmap -e 'add Control = Control_L'
```

靠 [`feh`][feh] 設定背景，又有 Linux 桌面可以用啦 XD

對了，看 [t][kuanyui] 考證才知道，

> rc (as in ".cshrc" or "/etc/rc") = "RunCom"
>
> "rc" derives from "runcom", from the MIT CTSS system, ca. 1965.
>
> 'There was a facility that would execute a bunch of commands stored in a file; it was called "runcom" for "run commands", and the file began to be called "a runcom." "rc" in Unix is a fossil from that usage.'

原來 rc 是 [RUNCOM][RUNCOM] 的簡寫，出自使用 IBM 7094 的 CTSS 系統：

> Louis Pouzin also invented RUNCOM for CTSS. This facility, the direct ancestor of the Unix shell script, allowed users to create a file-system file of commands to be executed, with parameter substitution. Louis also produced a design for the Multics shell, ancestor of the Unix shell.

[st]: https://st.suckless.org/
[feh]: https://wiki.archlinux.org/index.php/feh
[kuanyui]: http://kuanyui.github.io/
[RUNCOM]: http://multicians.org/thvv/7094.html
