Skip to content

Latest commit

 

History

History
148 lines (121 loc) · 4.49 KB

myenvironment.org

File metadata and controls

148 lines (121 loc) · 4.49 KB

Orchestrate my workplace

Ansible

Ansible can be installed from Rodney Quillo’s PPA:

sudo add-apt-repository ppa:rquillo/ansible
sudo apt-get update -qq
sudo apt-get install ansible

Qtile

On Ubuntu I install qtile from Tycho’s PPA

sudo add-apt-repository ppa:tycho-s/ppa
sudo apt-get update -qq
sudo apt-get install qtile

Conkeror

To install Conkeror I usually just clone it into my src folder and, assuming that firefox is already in the system, use the following alias:

if [ ! -f ~/src ]; then mkdir ~/src fi
git clone git://repo.or.cz/conkeror.git ~/src/conkeror
alias conkeror="firefox -app ${HOME}/src/conkeror/application.ini"

According to Conkeror wiki, to tell the system that conkeror is our default browser, we need to do the following:

if [ ! -f ~/.local/share/applications ]; then mkdir -p ~/.local/share/applications fi
cat > ~/.local/share/applications/conkeror.desktop << EOF
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=conkeror.png
Name=Conkeror
Comment=Emacs like Web Browser
GenericName=Web Browser
Exec=conkeror %u
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;
EOF
xdg-mime default conkeror.desktop x-scheme-handler/http
xdg-mime default conkeror.desktop x-scheme-handler/https
# sudo update-alternatives --config x-www-browser

Emacs

There is a Ubuntu Emacs Lisp PPA with a daily snapshot:

sudo add-apt-repository ppa:ubuntu-elisp/ppa
sudo apt-get update -qq
sudo apt-get install emacs-snapshot

Install packages from packages.el

emacs -q -batch -l {$HOME}/.emacs.d/packages.el -kill

Packages from the list are installed only if not already available, so I’m not sure if I really need an additional function to test if there is any package not installed yet for ansible.

Multiple configuration files

I tend to break configuration files of some applications, like conkeror or emacs, into multiple files:

- name: Conkeror config files
  copy:
    src=conkeror-{{ item }}
    dest={{ '%s/.conkerorrc/'|format(ansible_env.HOME) }}{{ item }}
  with_items:
    - init.js
    - webjumps.js
    - functions.js

I could even probably have one ansible task for all programs, it’s more complecated though:

- name: Configuration files
  copy:
    src={{ item.0.name }}-{{ item.1 }}
    dest={{ '%s/%s/%s'|format(ansible_env.HOME, item.0.cfgpath, item.1) }}
    mode=0644
  with_subelements:
    - myapps
    - files

And myapps list would look like this:

myapps:
  - name: qtile
    cfgpath: .config/qtile
    files:
      - config.py
  - name: emacs
    cfgpath: .emacs.d
    files:
      - init.el
      - custom.el
      - settings.el
  - name: conkeror
    cfgpath: .conkerorrc
    files:
      - init.js
      - webjumps.js
      - functions.js

Email

Having Ansible tasks is convenient when you have some apps built from source and when this app has some requirement, so you can keep these tasks together to know that these packages were installed to build this particular app:

- name: Install notmuch dependecies
  apt: pkg={{ item }} state=latest
  with_items:
    - libgmime-2.6-dev
    - libtalloc-dev
    - libxapian-dev
    - python-sphinx
    - zlib1g-dev
  sudo: yes

- name: Prepare notmuch package
  shell: make clean; ./configure --emacslispdir={{ ansible_env.HOME }}/.emacs.d/lisp --emacsetcdir={{ ansible_env.HOME }}/.emacs.d/lisp && make
    chdir={{ mysrcpath|default('%s/src'|format(ansible_env.HOME)) }}/notmuch
    creates=/usr/local/bin/notmuch
  register: notmuch_installed

- name: Install notmuch system-wide
  shell: make install
    chdir={{ mysrcpath|default('%s/src'|format(ansible_env.HOME)) }}/notmuch
  sudo: yes
  when: notmuch_installed|changed