Skip to content

Instantly share code, notes, and snippets.

@chorn
Created January 6, 2018 01:45
Show Gist options
  • Save chorn/bb5842f514943c154eb5242e5150c880 to your computer and use it in GitHub Desktop.
Save chorn/bb5842f514943c154eb5242e5150c880 to your computer and use it in GitHub Desktop.
#!/bin/bash
[[ -n "$ASDF_LANGUAGES" ]] || return
export NODEJS_CHECK_SIGNATURES=no
install_from_config_string() {
local -a env_languages=($1)
local -A languages
for language_and_versions in ${env_languages[@]} ; do
if [[ "$language_and_versions" =~ (.*)=(.*) ]] ; then
_lang="${BASH_REMATCH[1]}"
_versions=$(echo "${BASH_REMATCH[2]}" | sed -re 's/[\s:;,]+/ /')
languages[$_lang]="$_versions"
fi
done
for _lang in ${!languages[@]} ; do
local -a _versions=(${languages[$_lang]})
asdf plugin-add "$_lang"
for _version in ${_versions[@]} ; do
asdf install "$_lang" "$_version"
done
asdf global "$_lang" "${_versions[0]}"
asdf reshim "$_lang"
done
}
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
export PATH="$PATH:$HOME/.asdf/bin"
# source ~/.bashrc
install_from_config_string "$ASDF_LANGUAGES"
#!/bin/bash
git config --global --add core.excludesFile ~/.gitignore
git config --local --add core.excludesFile ~/.gitignore-pub-dotfiles
mv ~/.git ~/.git-pub-dotfiles
mkdir -p ~/.config ~/.config/nvim/autoload/
ln -s ~/.ghq/github.com/chriskempson/base16-shell ~/.config
ln -s ~/.ghq/github.com/chorn/dev_tool_updater/dev_tool_updater ~/bin
source ~/.bashrc
base16_twilight
curl -sflo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
ln -s ~/.vim/autoload/plug.vim ~/.config/nvim/autoload/plug.vim
# vim --not-a-term +qall
# nvim --headless +qall
# dev_tool_updater all
FROM base/archlinux:latest
LABEL maintainer="Chris Horn <chorn@chorn.com>"
ARG user="chorn"
ARG timezone="/usr/share/zoneinfo/US/Eastern"
ARG locale="en_US.UTF-8"
ARG dotfiles_repo="https://github.com/chorn/dotfiles"
ARG packages="base-devel bash-completion bc cmake cscope ctags erlang-nox fzf gist git go go-tools htop imagemagick jq lua mosh neovim net-tools nmap openssh openssl pass p7zip phantomjs pv python-neovim python-pip rsync shellcheck socat the_silver_searcher tmux unzip vim wget whois yarn zip zsh zsh-completions"
ARG aur_packages="direnv fasd"
ENV TERM "xterm-256color"
ENV ASDF_LANGUAGES "elixir=1.5.3 nodejs=9.3.0,8.9.3 python=3.6.4 ruby=2.5.0,2.4.2 rust=beta"
ENV GHQ_REPOS "chriskempson/base16-shell zdharma/fast-syntax-highlighting zsh-users/zsh-autosuggestions chorn/dev_tool_updater"
RUN locale-gen "${locale}" && ln -sf "${timezone}" /etc/localtime && \
pacman -Syu -qq --noconfirm --needed --noprogressbar --color never ${packages} && \
git clone "${dotfiles_repo}" "/home/${user}" && \
git clone https://aur.archlinux.org/package-query.git /usr/src/package-query && \
git clone https://aur.archlinux.org/yaourt.git /usr/src/yaourt && \
useradd --no-create-home --shell /bin/zsh "${user}" && \
echo "${user} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/docker && \
echo -e "root:root\n${user}:${user}" | chpasswd
WORKDIR /home/${user}
COPY dotfiles .
RUN chown -R "${user}:${user}" . /usr/src/{package-query,yaourt}
USER ${user}:${user}
RUN cd /usr/src/package-query && makepkg -simc --noprogressbar --noconfirm --needed && \
cd /usr/src/yaourt && makepkg -simc --noprogressbar --noconfirm --needed && \
yaourt -S --noconfirm --noprogressbar --needed ${aur_packages}
COPY user_setup asdf_setup dev_provision ./
RUN ./user_setup && rm user_setup
RUN ./asdf_setup && rm asdf_setup
RUN ./dev_provision
ENTRYPOINT ["/bin/zsh", "-l"]
#!/bin/bash
[[ -n "$GHQ_REPOS" ]] || return
export GOPATH="$HOME/.go"
mkdir -p "$GOPATH/bin"
export PATH="$PATH:$GOPATH/bin"
go get github.com/motemen/ghq
for repo in $GHQ_REPOS ; do
ghq get "$repo"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment