diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..384ef2a --- /dev/null +++ b/.bash_profile @@ -0,0 +1,8 @@ +# Setups system and user profiles and related variables +# /etc/profile will be sourced by bash automatically +# Setups home environment profile +if [ -f ~/.profile ]; then source ~/.profile; fi + +# Honor per-interactive-shell startup file +if [ -f ~/.bashrc ]; then source ~/.bashrc; fi + export HISTFILE=$XDG_CACHE_HOME/.bash_history diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..cc9a472 --- /dev/null +++ b/.bashrc @@ -0,0 +1,34 @@ +# Bash initialization for interactive non-login shells and +# for remote shells (info "(bash) Bash Startup Files"). + +# Export 'SHELL' to child processes. Programs such as 'screen' +# honor it and otherwise use /bin/sh. +export SHELL + +if [[ $- != *i* ]] +then + # We are being invoked from a non-interactive shell. If this + # is an SSH session (as in "ssh host command"), source + # /etc/profile so we get PATH and other essential variables. + [[ -n "$SSH_CLIENT" ]] && source /etc/profile + + # Don't do anything else. + return +fi + +# Source the system-wide file. +# source /etc/bashrc + +source /usr/etc/profile + +# Adjust the prompt depending on whether we're in 'guix environment'. +if [ -n "$GUIX_ENVIRONMENT" ] +then + PS1='\u@\h \w [env]\$ ' +else + PS1='\u@\h \w\$ ' +fi +alias ls='ls -p --color=auto' +alias ll='ls -l' +alias grep='grep --color=auto' +alias clear="printf '\e[2J\e[H'" diff --git a/README.org b/README.org index a496415..cc8524e 100644 --- a/README.org +++ b/README.org @@ -35,6 +35,13 @@ You can also parse individual Org files using [[file:./laundry/cli.rkt]]. #+begin_src bash :results drawer laundry/cli.rkt docs/thoughts.org laundry/test.org #+end_src + +* Reproducible Development Environment +To have a (GNU Guix) fully Reproducible Development Environment run +#+begin_src bash :results drawer +./run.sh +#+end_src + * Status Laundry can parse most of Org syntax, though there are still issues with the correctness of the parse in a number of cases. diff --git a/channels-lock.scm b/channels-lock.scm new file mode 100644 index 0000000..e75140f --- /dev/null +++ b/channels-lock.scm @@ -0,0 +1,11 @@ +(list (channel + (name 'guix) + (url "https://git.savannah.gnu.org/git/guix.git") + (branch "master") + (commit + "67817299808a03e2750cfb630dc09fe8eb99c468") + (introduction + (make-channel-introduction + "9edb3f66fd807b096b48283debdcddccfea34bad" + (openpgp-fingerprint + "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))) diff --git a/etc/profile b/etc/profile new file mode 100755 index 0000000..9816c04 --- /dev/null +++ b/etc/profile @@ -0,0 +1,33 @@ +# /etc/profile + +ri () { + set -x + raco pkg install --deps search-auto laundry + { retval="$?"; } 2>/dev/null + { set +x; } 2>/dev/null + return $retval +} + +rt () { + set -x + raco test --package laundry + { retval="$?"; } 2>/dev/null + { set +x; } 2>/dev/null + return $retval +} + +go () { + ri && rt +} + +cat << EOF +========================================= + ____ _ _ _ _ ____ _ + / ___| \ | | | | | / ___|_ _(_)_ __ +| | _| \| | | | | | | _| | | | \ \/ / +| |_| | |\ | |_| | | |_| | |_| | |> < + \____|_| \_|\___/ \____|\__,_|_/_/\_\\ + +Available commands: ri rt go +========================================= +EOF diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..6c39d45 --- /dev/null +++ b/run.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# +# GNU Guix Reproducible Development Environment + +WD=$(pwd) # WD=$(dirname "$0") # i.e. path to this file + +# --container run command within an isolated container +# --network allow containers to access the network +# --no-cwd don't share current working directory with an isolated container +# --preserve preserve environment variables that match the REGEXP +# --expose expose read-only host file system according to SPEC +# The --preserve and --expose parameters are needed so that `raco test laundry` +# doesn't complain: +# raco test: (submod "~/.local/share/racket/8.3/pkgs/laundry/colorer.rkt" test) +# Unable to init server: Could not connect: Connection refused +# Gtk initialization failed for display ":0" +# ... +# raco test: "~/.local/share/racket/8.3/pkgs/laundry/perf.rkt" +# Unable to init server: Could not connect: Connection refused +# Gtk initialization failed for display ":0" + +# Full freeze of Guix channels: +# guix time-machine --channels=./channels-lock.scm -- shell \ +# --container --network REST-OF-ARGS-OF-GUIX-SHELL + +# xtrace: Print commands and their arguments as they are executed +set -x + +guix shell \ + --container --network --no-cwd \ + racket bash grep coreutils which openssl nss-certs \ + --preserve='^DISPLAY$' --preserve='^XAUTHORITY$' --expose=$XAUTHORITY \ + --share=$WD/.bash_profile=$HOME/.bash_profile \ + --share=$WD/.bashrc=$HOME/.bashrc \ + --share=$WD/etc=/usr/etc \ + --share=/etc/ssl/certs \ + --share=$WD \ + -- bash