-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup GNU Guix Reproducible Development Environment
- Loading branch information
Showing
6 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |