From 56236c0e1aed4166fac8bd5908f28ddc5f928c96 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 19 May 2015 09:02:17 -0400 Subject: Update dotfiles with new Guile-based installer. --- Makefile | 2 +- README.org | 11 +--- dotfiles/.bash_profile | 5 ++ dotfiles/.bashrc | 25 ++++++++ dotfiles/.dmd.d/init.scm | 38 +++++++++++++ dotfiles/.guile | 4 ++ dotfiles/.screenrc | 8 +++ dotfiles/.signature | 2 + dotfiles/.xmodmap | 9 +++ dotfiles/Mail/.notmuch/hooks/post-new | 44 ++++++++++++++ dotfiles/Mail/.notmuch/hooks/pre-new | 22 +++++++ dotfiles/bash_aliases | 1 - dotfiles/bashrc | 104 ---------------------------------- dotfiles/dmd.d/init.scm | 38 ------------- dotfiles/gitconfig | 3 - dotfiles/guile | 2 - dotfiles/screenrc | 8 --- dotfiles/xinitrc | 2 - dotfiles/xmodmap | 9 --- install.scm | 92 ++++++++++++++++++++++++++++++ install.sh | 9 --- 21 files changed, 251 insertions(+), 187 deletions(-) create mode 100644 dotfiles/.bash_profile create mode 100644 dotfiles/.bashrc create mode 100644 dotfiles/.dmd.d/init.scm create mode 100644 dotfiles/.guile create mode 100644 dotfiles/.screenrc create mode 100644 dotfiles/.signature create mode 100644 dotfiles/.xmodmap create mode 100755 dotfiles/Mail/.notmuch/hooks/post-new create mode 100755 dotfiles/Mail/.notmuch/hooks/pre-new delete mode 100644 dotfiles/bash_aliases delete mode 100644 dotfiles/bashrc delete mode 100644 dotfiles/dmd.d/init.scm delete mode 100644 dotfiles/gitconfig delete mode 100644 dotfiles/guile delete mode 100644 dotfiles/screenrc delete mode 100644 dotfiles/xinitrc delete mode 100644 dotfiles/xmodmap create mode 100755 install.scm delete mode 100755 install.sh diff --git a/Makefile b/Makefile index 4461578..82d1bc6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ # This makefile might be more useful eventually. install: - ./install.sh + ./install.scm diff --git a/README.org b/README.org index a82e55b..123c6c0 100644 --- a/README.org +++ b/README.org @@ -4,17 +4,8 @@ Perhaps you are interested in my Emacs configuration. That has its own repository. [[https://github.com/davexunit/.emacs.d][Check it out.]] -** What's in the Box? - You will find my configuration files for: - - Bash - - Git - - GNU Guile - - GNU Screen - - StumpWM - - X - ** Installing The dotfiles are installed by creating symlinks from the =dotfiles/= directory to the current user's home directory. - To install, just run =make=. + To install, just run =make install=. diff --git a/dotfiles/.bash_profile b/dotfiles/.bash_profile new file mode 100644 index 0000000..f591848 --- /dev/null +++ b/dotfiles/.bash_profile @@ -0,0 +1,5 @@ +# -*- shell-script -*- + +if [ -f $HOME/.bashrc ]; then source $HOME/.bashrc; fi + +export PATH="$HOME/.guix-profile/bin:$HOME/.guix-profile/sbin:$PATH" diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc new file mode 100644 index 0000000..7112468 --- /dev/null +++ b/dotfiles/.bashrc @@ -0,0 +1,25 @@ +# -*- shell-script -*- + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# don't put duplicate lines or lines starting with space in the history. +HISTCONTROL=ignoreboth + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# The pattern "**" used in a pathname expansion context will match all +# files and zero or more directories and subdirectories. +shopt -s globstar + +# Alias for development guix +alias guix="$HOME/Code/guix/pre-inst-env guix" diff --git a/dotfiles/.dmd.d/init.scm b/dotfiles/.dmd.d/init.scm new file mode 100644 index 0000000..420c7cf --- /dev/null +++ b/dotfiles/.dmd.d/init.scm @@ -0,0 +1,38 @@ +(use-modules (ice-9 match)) + +(define-syntax-rule (forever body ...) + (while #t body ...)) + +(define-syntax-rule (with-fork body ...) + (match (primitive-fork) + (0 (begin body ...)) + (pid pid))) + +(define (simple-service program) + (make + #:provides (list (string->symbol program)) + #:requires '() + #:start (make-forkexec-constructor (list program)) + #:stop (make-kill-destructor))) + +(register-services + (make + #:provides '(offlineimap) + #:requires '() + #:start (lambda args + (with-fork + ;; OfflineIMAP's "autorefresh" mode consistently + ;; consumes all of the RAM on my machine, so let's just + ;; run it in a loop instead. + (forever + (system* "offlineimap") + (sleep 20)))) + #:stop (make-kill-destructor)) + (simple-service "mpd") + (simple-service "mpdscribble")) + +;; Send dmd into the background +(action 'dmd 'daemonize) + +;; Services to start when dmd starts: +(for-each start '(offlineimap mpd mpdscribble)) diff --git a/dotfiles/.guile b/dotfiles/.guile new file mode 100644 index 0000000..0a0d711 --- /dev/null +++ b/dotfiles/.guile @@ -0,0 +1,4 @@ +# -*- scheme -*- + +(use-modules (ice-9 readline)) +(activate-readline) diff --git a/dotfiles/.screenrc b/dotfiles/.screenrc new file mode 100644 index 0000000..fd40886 --- /dev/null +++ b/dotfiles/.screenrc @@ -0,0 +1,8 @@ +# Large scrollback buffer +defscrollback 8192 + +# Don't bug me +startup_message off + +# Hardstatus line +hardstatus alwayslastline " [ %-w%{+b ..}%n %t%{-}%+w ]%-= [ %C ] [ %H ]" diff --git a/dotfiles/.signature b/dotfiles/.signature new file mode 100644 index 0000000..9f6a9c3 --- /dev/null +++ b/dotfiles/.signature @@ -0,0 +1,2 @@ +David Thompson +GPG Key: 0FF1D807 diff --git a/dotfiles/.xmodmap b/dotfiles/.xmodmap new file mode 100644 index 0000000..aaec870 --- /dev/null +++ b/dotfiles/.xmodmap @@ -0,0 +1,9 @@ +! +! Swap Caps_Lock and Control_L +! +remove Lock = Caps_Lock +remove Control = Control_L +keysym Control_L = Control_L +keysym Caps_Lock = Control_L +add Lock = Caps_Lock +add Control = Control_L \ No newline at end of file diff --git a/dotfiles/Mail/.notmuch/hooks/post-new b/dotfiles/Mail/.notmuch/hooks/post-new new file mode 100755 index 0000000..b829d40 --- /dev/null +++ b/dotfiles/Mail/.notmuch/hooks/post-new @@ -0,0 +1,44 @@ +#!/bin/sh + +# Mail that I sent doesn't need to be put in the inbox +notmuch tag -new -- from:davet@gnu.org OR from:davet@fsf.org OR \ + from:dthompson2@worcester.edu + +# Commit notifications +notmuch tag -new +commits -- subject:Office-commits \ + OR from:account for gitolite OR to:www-commits@gnu.org + +# Fencepost updates +notmuch tag -new +fencepost -- from:diffmon@gnu.org + +# GNU webmasters +notmuch tag -new +webmasters -- from:webmasters@gnu.org \ + OR from:webmasters-comment@gnu.org + +# FSF sysadmins +notmuch tag -new +fsfsys -- from:sysadmin@gnu.org \ + OR from:sysadmin-comment@gnu.org + +# Linode +notmuch tag -new +linode -- from:billing@linode.com + +# Mark spam +notmuch tag -new +spam -- folder:FSF/INBOX.Spam OR folder:WSU/[Gmail].Spam +notmuch tag -new +spam -- from:john.pozzi@comcast.net # Do not feed + +# Loomio +notmuch tag +loomio -new -- from:notifications@loomio.org + +# Remaining new mail goes to the inbox +notmuch tag -new +inbox +unread -- tag:new + +# GNU mailing lists +notmuch tag -inbox +guix -- to:guix-devel@gnu.org OR to:bug-guix@gnu.org +notmuch tag -inbox +guile -- to:guile-devel@gnu.org OR to:guile-user@gnu.org +notmuch tag -inbox +gnu -- to:gnu-prog-discuss@gnu.org +notmuch tag -inbox +mediagoblin -- to:devel@mediagoblin.org +notmuch tag -inbox +gnu-webmasters -- to:www-discuss@gnu.org + +# Remove inbox tag from all mail in archive +notmuch tag -inbox -- folder:WSU/Archive AND tag:inbox +notmuch tag -inbox -- folder:FSF/INBOX.Archive AND tag:inbox diff --git a/dotfiles/Mail/.notmuch/hooks/pre-new b/dotfiles/Mail/.notmuch/hooks/pre-new new file mode 100755 index 0000000..db83fa4 --- /dev/null +++ b/dotfiles/Mail/.notmuch/hooks/pre-new @@ -0,0 +1,22 @@ +#!/bin/sh + +# Delete mail +#notmuch search --output=files tag:deleted | xargs -rl rm + +# Move marked spam to spam folder +notmuch search --output=files path:FSF/** AND NOT folder:FSF/INBOX.Spam \ + AND tag:spam | xargs -I '{}' mv '{}' ~/Mail/FSF/INBOX.Spam/cur + +# Delete spam after one week +notmuch tag +deleted -- tag:spam AND date:..one_week + +# Delete commits after one month +notmuch tag +deleted -- tag:commits AND date:..one_month + +# Move mail from inbox to archive +notmuch search --output=files --duplicate=1 folder:WSU/INBOX AND NOT tag:inbox \ + | xargs -I '{}' mv '{}' ~/Mail/WSU/Archive/cur +notmuch search --output=files --duplicate=1 folder:FSF/INBOX AND NOT tag:inbox \ + | xargs -I '{}' mv '{}' ~/Mail/FSF/INBOX.Archive/cur + +exit 0 diff --git a/dotfiles/bash_aliases b/dotfiles/bash_aliases deleted file mode 100644 index 872ede7..0000000 --- a/dotfiles/bash_aliases +++ /dev/null @@ -1 +0,0 @@ -alias aigis='ssh dave@aigis' \ No newline at end of file diff --git a/dotfiles/bashrc b/dotfiles/bashrc deleted file mode 100644 index a4158ef..0000000 --- a/dotfiles/bashrc +++ /dev/null @@ -1,104 +0,0 @@ -# -# ~/.bashrc -# - -# If not running interactively, don't do anything -[[ $- != *i* ]] && return - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=1000 -HISTFILESIZE=2000 - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# make less more friendly for non-text input files, see lesspipe(1) -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (used in the prompt below) -if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm-color) color_prompt=yes;; -esac - -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -#force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - -if [ "$color_prompt" = yes ]; then - PS1='[${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]]\$ ' -else - PS1='[${debian_chroot:+($debian_chroot)}\u@\h \w]\$ ' -fi -unset color_prompt force_color_prompt - -# If this is an xterm set the title to user@host:dir -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; -*) - ;; -esac - -# enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' -fi - -# some more ls aliases -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' - -# Add an "alert" alias for long running commands. Use like so: -# sleep 10; alert -alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' - -# Alias definitions. -# You may want to put all your additions into a separate file like -# ~/.bash_aliases, instead of adding them here directly. -# See /usr/share/doc/bash-doc/examples in the bash-doc package. - -if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases -fi - -# enable programmable completion features (you don't need to enable -# this, if it's already enabled in /etc/bash.bashrc and /etc/profile -# sources /etc/bash.bashrc). -if [ -f /etc/bash_completion ] && ! shopt -oq posix; then - . /etc/bash_completion -fi - -# Add RVM to PATH for scripting -# Add Carton to PATH for Emacs development -PATH=$PATH:$HOME/.rvm/bin:$HOME/.carton/bin -export PATH diff --git a/dotfiles/dmd.d/init.scm b/dotfiles/dmd.d/init.scm deleted file mode 100644 index 420c7cf..0000000 --- a/dotfiles/dmd.d/init.scm +++ /dev/null @@ -1,38 +0,0 @@ -(use-modules (ice-9 match)) - -(define-syntax-rule (forever body ...) - (while #t body ...)) - -(define-syntax-rule (with-fork body ...) - (match (primitive-fork) - (0 (begin body ...)) - (pid pid))) - -(define (simple-service program) - (make - #:provides (list (string->symbol program)) - #:requires '() - #:start (make-forkexec-constructor (list program)) - #:stop (make-kill-destructor))) - -(register-services - (make - #:provides '(offlineimap) - #:requires '() - #:start (lambda args - (with-fork - ;; OfflineIMAP's "autorefresh" mode consistently - ;; consumes all of the RAM on my machine, so let's just - ;; run it in a loop instead. - (forever - (system* "offlineimap") - (sleep 20)))) - #:stop (make-kill-destructor)) - (simple-service "mpd") - (simple-service "mpdscribble")) - -;; Send dmd into the background -(action 'dmd 'daemonize) - -;; Services to start when dmd starts: -(for-each start '(offlineimap mpd mpdscribble)) diff --git a/dotfiles/gitconfig b/dotfiles/gitconfig deleted file mode 100644 index 8dd42e3..0000000 --- a/dotfiles/gitconfig +++ /dev/null @@ -1,3 +0,0 @@ -[user] - name = David Thompson - email = dthompson@member.fsf.org diff --git a/dotfiles/guile b/dotfiles/guile deleted file mode 100644 index 728e4a9..0000000 --- a/dotfiles/guile +++ /dev/null @@ -1,2 +0,0 @@ -(use-modules (ice-9 readline)) -(activate-readline) \ No newline at end of file diff --git a/dotfiles/screenrc b/dotfiles/screenrc deleted file mode 100644 index fd40886..0000000 --- a/dotfiles/screenrc +++ /dev/null @@ -1,8 +0,0 @@ -# Large scrollback buffer -defscrollback 8192 - -# Don't bug me -startup_message off - -# Hardstatus line -hardstatus alwayslastline " [ %-w%{+b ..}%n %t%{-}%+w ]%-= [ %C ] [ %H ]" diff --git a/dotfiles/xinitrc b/dotfiles/xinitrc deleted file mode 100644 index 4fb267e..0000000 --- a/dotfiles/xinitrc +++ /dev/null @@ -1,2 +0,0 @@ -xmodmap ~/.xmodmap & -exec stumpwm diff --git a/dotfiles/xmodmap b/dotfiles/xmodmap deleted file mode 100644 index aaec870..0000000 --- a/dotfiles/xmodmap +++ /dev/null @@ -1,9 +0,0 @@ -! -! Swap Caps_Lock and Control_L -! -remove Lock = Caps_Lock -remove Control = Control_L -keysym Control_L = Control_L -keysym Caps_Lock = Control_L -add Lock = Caps_Lock -add Control = Control_L \ No newline at end of file diff --git a/install.scm b/install.scm new file mode 100755 index 0000000..7922a48 --- /dev/null +++ b/install.scm @@ -0,0 +1,92 @@ +#!/usr/bin/guile --no-auto-compile +!# + +(use-modules (ice-9 ftw) + (ice-9 i18n) + (ice-9 match) + (srfi srfi-1) + (srfi srfi-11) + (srfi srfi-26)) + +(define (recursive-scandir dir) + "Return a list of all the file names in DIR, recursively." + (define (components file) + (string-split file #\/)) + + (define suffix + (let ((prefix-length (length (components dir)))) + (lambda (file) + (string-join (drop (components file) prefix-length) "/")))) + + (define enter? (const #t)) + + (define (leaf name stat result) + (cons (suffix name) result)) + + ;; No-op + (define (down name stat result) result) + (define (up name stat result) result) + (define (skip name stat result) result) + (define (error name stat errno result) result) + + (let-values (((files discard) + (file-system-fold enter? leaf down up skip error '() dir))) + (sort files string-locale