summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-05-19 09:02:17 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-05-19 09:02:17 -0400
commit56236c0e1aed4166fac8bd5908f28ddc5f928c96 (patch)
tree1580707df3639a61e10b1d3bfb6c7e57e560c446
parent1e579064aed9f32061e5edbe1c693cab21f0ce75 (diff)
Update dotfiles with new Guile-based installer.
-rw-r--r--Makefile2
-rw-r--r--README.org11
-rw-r--r--dotfiles/.bash_profile5
-rw-r--r--dotfiles/.bashrc25
-rw-r--r--dotfiles/.dmd.d/init.scm (renamed from dotfiles/dmd.d/init.scm)0
-rw-r--r--dotfiles/.guile4
-rw-r--r--dotfiles/.screenrc (renamed from dotfiles/screenrc)0
-rw-r--r--dotfiles/.signature2
-rw-r--r--dotfiles/.xmodmap (renamed from dotfiles/xmodmap)0
-rwxr-xr-xdotfiles/Mail/.notmuch/hooks/post-new44
-rwxr-xr-xdotfiles/Mail/.notmuch/hooks/pre-new22
-rw-r--r--dotfiles/bash_aliases1
-rw-r--r--dotfiles/bashrc104
-rw-r--r--dotfiles/gitconfig3
-rw-r--r--dotfiles/guile2
-rw-r--r--dotfiles/xinitrc2
-rwxr-xr-xinstall.scm92
-rwxr-xr-xinstall.sh9
18 files changed, 196 insertions, 132 deletions
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
index 420c7cf..420c7cf 100644
--- a/dotfiles/dmd.d/init.scm
+++ b/dotfiles/.dmd.d/init.scm
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
index fd40886..fd40886 100644
--- a/dotfiles/screenrc
+++ b/dotfiles/.screenrc
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
index aaec870..aaec870 100644
--- a/dotfiles/xmodmap
+++ b/dotfiles/.xmodmap
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/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/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/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<?)))
+
+(define (mkdir-p dir)
+ "Create directory DIR and all its ancestors."
+ (define absolute?
+ (string-prefix? "/" dir))
+
+ (define not-slash
+ (char-set-complement (char-set #\/)))
+
+ (let loop ((components (string-tokenize dir not-slash))
+ (root (if absolute?
+ ""
+ ".")))
+ (match components
+ ((head tail ...)
+ (let ((path (string-append root "/" head)))
+ (catch 'system-error
+ (lambda ()
+ (mkdir path)
+ (loop tail path))
+ (lambda args
+ (if (= EEXIST (system-error-errno args))
+ (loop tail path)
+ (apply throw args))))))
+ (() #t))))
+
+(define (symlink? file)
+ "Return #t if FILE is a symbolic link."
+ (eq? (stat:type (lstat file)) 'symlink))
+
+(define (already-linked? src-file dest-file)
+ "Return #t if SRC-FILE is a symbolic link to DEST-FILE."
+ (and (symlink? dest-file)
+ (string=? (readlink dest-file) src-file)))
+
+(define %home (getenv "HOME"))
+
+(define %dotfiles-dir
+ (string-append (getcwd) "/dotfiles"))
+
+(define (install-dotfile file)
+ "Create a symlink to FILE in the current user's home directory."
+ (let ((src-file (string-append %dotfiles-dir "/" file))
+ (dest-file (string-append %home "/" file)))
+ (cond
+ ((not (file-exists? dest-file))
+ (format #t "~a → ~a~%" file dest-file)
+ (mkdir-p (dirname dest-file))
+ (symlink src-file dest-file))
+ ((already-linked? src-file dest-file)
+ (format #t "~a already installed~%" file))
+ (else
+ (error "destination file already exists: " dest-file)))))
+
+(define %dotfiles
+ (recursive-scandir "dotfiles"))
+
+(for-each install-dotfile %dotfiles)
diff --git a/install.sh b/install.sh
deleted file mode 100755
index d65961f..0000000
--- a/install.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Symlink dotfiles to ~
-
-for file in dotfiles/*; do
- target=`realpath $file`
- link_name=~/.`basename $file`
-
- ln -fvs $target $link_name
-done