@@ -1,4 +1,9 @@
|
||||
.gitignore
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
README.md
|
||||
|
||||
**/plugged
|
||||
**/completions
|
||||
**/conf.d
|
||||
**/fish_variables
|
||||
**/functions
|
||||
|
||||
11
.github/workflows/ci.yml
vendored
Normal file
11
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
name: Dotfiles CI
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Run test suite
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run tests
|
||||
run: ./scripts/test.sh
|
||||
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
@@ -1,10 +0,0 @@
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
name: tests
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run tests
|
||||
run: make test
|
||||
20
.github/workflows/publish.yml
vendored
Normal file
20
.github/workflows/publish.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: Dotfiles publisher
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
publish-installer:
|
||||
name: Publish setup script
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Cloud SDK
|
||||
uses: google-github-actions/setup-gcloud@master
|
||||
with:
|
||||
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
||||
service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
|
||||
export_default_credentials: true
|
||||
- name: Publish to CDN
|
||||
run: ./scripts/publish.sh
|
||||
24
.gitignore
vendored
24
.gitignore
vendored
@@ -1,18 +1,14 @@
|
||||
# custom functions
|
||||
!files/.config/fish/functions/nvm.fish
|
||||
|
||||
# install artefacts
|
||||
tmp
|
||||
logs/*
|
||||
**/tmp
|
||||
**/logs
|
||||
**/*.deb
|
||||
|
||||
# ssh env
|
||||
**/id_rsa*
|
||||
**/known_hosts*
|
||||
|
||||
# setup files
|
||||
**/plugged
|
||||
**/autoload
|
||||
**/functions
|
||||
**/completions
|
||||
**/conf.d
|
||||
**/fish_variables
|
||||
**/gcloud
|
||||
**/coc
|
||||
**/configstore
|
||||
@@ -20,11 +16,3 @@ logs/*
|
||||
**/TabNine
|
||||
**/firebase
|
||||
**/pypoetry
|
||||
|
||||
# pytest
|
||||
**/__pycache__
|
||||
**/.pytest_cache
|
||||
|
||||
# ssh env
|
||||
**/id_rsa*
|
||||
**/known_hosts*
|
||||
|
||||
56
Dockerfile
56
Dockerfile
@@ -1,28 +1,46 @@
|
||||
FROM ubuntu:bionic as install
|
||||
#
|
||||
# debian-buster: Base Debian image with sudo user
|
||||
#
|
||||
FROM debian:buster AS debian-base
|
||||
|
||||
# Install sudo and make, git since built-in is skipped
|
||||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||
RUN apt-get -qqy update \
|
||||
&& apt-get -qqy install curl git make software-properties-common sudo
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN apt-get -qq update
|
||||
RUN apt-get -qq install --no-install-recommends \
|
||||
apt-utils software-properties-common sudo
|
||||
|
||||
# Create user with sudo priviledge
|
||||
ARG USER="test-user"
|
||||
RUN useradd --create-home -m "$USER" \
|
||||
&& adduser "$USER" sudo
|
||||
RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" \
|
||||
RUN useradd -r -u 1001 --create-home -m "test-user"
|
||||
RUN adduser "test-user" sudo
|
||||
RUN echo "test-user ALL=(ALL) NOPASSWD: ALL" \
|
||||
>>/etc/sudoers
|
||||
|
||||
# Filesystem steps
|
||||
RUN rm /home/$USER/.profile /home/$USER/.bashrc
|
||||
ENV WORKSPACE="/home/$USER/workspace"
|
||||
ADD --chown=test-user . "$WORKSPACE/dotfiles"
|
||||
WORKDIR "$WORKSPACE/dotfiles"
|
||||
|
||||
# Install steps
|
||||
#
|
||||
# source: Source steps
|
||||
#
|
||||
FROM debian-base AS source
|
||||
|
||||
ARG DOTFILES_DIR="/home/test-user/.dotfiles"
|
||||
ADD --chown="test-user" . "$DOTFILES_DIR"
|
||||
WORKDIR "$DOTFILES_DIR"
|
||||
|
||||
|
||||
#
|
||||
# install: Install steps
|
||||
#
|
||||
FROM source AS install
|
||||
|
||||
USER test-user
|
||||
ARG TARGET="all"
|
||||
ENV LOG_TARGET="STDOUT"
|
||||
RUN make install TARGET=$TARGET
|
||||
ENV USER=test-user
|
||||
ARG UUID="docker"
|
||||
RUN ./scripts/install.sh
|
||||
|
||||
# Test entrypoint
|
||||
ENTRYPOINT [ "make", "--directory", "tests", "TARGET=$TARGET" ]
|
||||
|
||||
#
|
||||
# test: Test entrypoint
|
||||
#
|
||||
FROM install AS test
|
||||
|
||||
WORKDIR "${DOTFILES_DIR}/tests"
|
||||
ENTRYPOINT [ "./run.sh" ]
|
||||
|
||||
35
Makefile
35
Makefile
@@ -1,35 +0,0 @@
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Local commands
|
||||
# ---------------------------------------------------------------------------- #
|
||||
.PHONY: clean install
|
||||
|
||||
# Install dotfiles to home folder
|
||||
all:
|
||||
./bootstrap.pl
|
||||
|
||||
# @arg $TARGET binary to install
|
||||
install:
|
||||
./install.pl
|
||||
|
||||
clean:
|
||||
rm -rf logs
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Docker commands
|
||||
# ---------------------------------------------------------------------------- #
|
||||
.PHONY: build test start
|
||||
|
||||
# Build and tag docker image
|
||||
build:
|
||||
docker build . -t dotfiles:latest
|
||||
|
||||
# Run tests in docker container
|
||||
# @arg $TARGET binary to install and test
|
||||
test:
|
||||
docker build . -t dotfiles:localtest \
|
||||
--build-arg TARGET=$$TARGET \
|
||||
&& docker run dotfiles:localtest
|
||||
|
||||
# Launch bash in docker container
|
||||
start:
|
||||
docker run -it dotfiles:latest /bin/bash
|
||||
40
README.md
40
README.md
@@ -1,31 +1,35 @@
|
||||
# dotfiles
|
||||
# dots.andrejus.dev
|
||||
|
||||
Collection of experimental dotfiles and supporting install scripts.
|
||||
Tested on and compatible with:
|
||||
|
||||
- Ubuntu 20.04
|
||||
Collection of my dotfiles and supporting install scripts
|
||||
|
||||
## Install
|
||||
|
||||
wget https://raw.githubusercontent.com/andrejusk/dotfiles/master/setup.pl -qO - | perl
|
||||
[](https://github.com/andrejusk/dotfiles/actions/workflows/publish.yml)
|
||||
|
||||
wget https://dots.andrejus.dev/setup.sh -qO - | bash
|
||||
|
||||
## Stack
|
||||
|
||||
Shell: 🐟 fish (+ fisher)
|
||||
[](https://github.com/andrejusk/dotfiles/actions/workflows/ci.yml)
|
||||
|
||||
Editor: neovim (+ vim-plug)
|
||||
Tested and maintained against Debian buster
|
||||
|
||||
Tools:
|
||||
### Shells
|
||||
|
||||
- aws, gcloud, firebase
|
||||
- docker (+ docker-compose)
|
||||
- kubectl
|
||||
- terraform
|
||||
- screenfetch
|
||||
- 🐟 fish (+ fisher)
|
||||
|
||||
Languages:
|
||||
### Editors
|
||||
|
||||
- java
|
||||
- js (nvm, node, yarn)
|
||||
- neovim (+ vim-plug)
|
||||
- emacs
|
||||
|
||||
### Languages
|
||||
|
||||
- node.js (nvm, yarn)
|
||||
- python (pyenv, poetry)
|
||||
- ruby
|
||||
|
||||
### Tools
|
||||
|
||||
- docker
|
||||
- terraform
|
||||
- gcloud, firebase, awscli
|
||||
|
||||
26
bootstrap.pl
26
bootstrap.pl
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use warnings;
|
||||
use autodie;
|
||||
|
||||
use Cwd;
|
||||
use Data::Dumper;
|
||||
use Stow;
|
||||
|
||||
|
||||
my $dir = getcwd;
|
||||
my $target = $ENV{'HOME'};
|
||||
print "Stowing $dir/files to $target\n";
|
||||
|
||||
my %stow_options = ( dir => $dir,
|
||||
target => $target );
|
||||
my $stow = new Stow(%stow_options);
|
||||
|
||||
my @pkgs = ('files');
|
||||
$stow->plan_stow(@pkgs);
|
||||
my %conflicts = $stow->get_conflicts;
|
||||
if (%conflicts) {
|
||||
my $dump = Dumper(%conflicts);
|
||||
die("Failed to stow, conflicts: $dump");
|
||||
}
|
||||
$stow->process_tasks();
|
||||
@@ -1,3 +0,0 @@
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
||||
3
files/home/.bashrc
Normal file
3
files/home/.bashrc
Normal file
@@ -0,0 +1,3 @@
|
||||
# Load nvm bash dependency
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
55
files/home/.config/alacritty/alacritty.yml
Normal file
55
files/home/.config/alacritty/alacritty.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
env:
|
||||
TERM: xterm-256color
|
||||
|
||||
window:
|
||||
dynamic_title: true
|
||||
dynamic_padding: true
|
||||
decorations: None
|
||||
startup_mode: Windowed
|
||||
|
||||
dimensions:
|
||||
columns: 120
|
||||
lines: 32
|
||||
|
||||
padding:
|
||||
x: 12
|
||||
y: 7
|
||||
|
||||
scrolling:
|
||||
history: 10000
|
||||
multiplier: 3
|
||||
|
||||
font:
|
||||
size: 10.0
|
||||
normal:
|
||||
family: FiraCode Nerd Font Mono
|
||||
style: Regular
|
||||
|
||||
bold:
|
||||
family: FiraCode Nerd Font Mono
|
||||
style: Bold
|
||||
|
||||
italic:
|
||||
family: FiraSansCondensed NF
|
||||
style: Italic
|
||||
|
||||
bold_italic:
|
||||
family: FiraSansCondensed NF
|
||||
style: Bold Italic
|
||||
|
||||
draw_bold_text_with_bright_colors: false
|
||||
background_opacity: 0.95
|
||||
|
||||
cursor:
|
||||
style: Beam
|
||||
unfocused_hollow: true
|
||||
|
||||
live_config_reload: true
|
||||
|
||||
key_bindings:
|
||||
- { key: V, mods: Control|Shift, action: Paste }
|
||||
- { key: C, mods: Control|Shift, action: Copy }
|
||||
- { key: Insert, mods: Shift, action: PasteSelection }
|
||||
- { key: Key0, mods: Control, action: ResetFontSize }
|
||||
- { key: Plus, mods: Control, action: IncreaseFontSize }
|
||||
- { key: Minus, mods: Control, action: DecreaseFontSize }
|
||||
3
files/home/.config/fish/.gitignore
vendored
Normal file
3
files/home/.config/fish/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
completions
|
||||
conf.d
|
||||
fish_variables
|
||||
@@ -1,5 +1,6 @@
|
||||
# Only execute in interactive shell
|
||||
if status --is-interactive
|
||||
if status is-interactive
|
||||
|
||||
# Fish specific
|
||||
set fish_greeting
|
||||
set --global hydro_symbol_prompt "\$"
|
||||
@@ -12,4 +13,5 @@ if status --is-interactive
|
||||
if begin; test -e $HOME/.profile; and type -q replay; end
|
||||
replay "source $HOME/.profile"
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
jethrokuan/z
|
||||
jorgebucaran/fisher
|
||||
jorgebucaran/hydro
|
||||
jorgebucaran/replay.fish
|
||||
joseluisq/gitnow
|
||||
tomyun/base16-fish
|
||||
PatrickF1/fzf.fish
|
||||
jorgebucaran/fisher
|
||||
6
files/home/.config/fish/functions/.gitignore
vendored
Normal file
6
files/home/.config/fish/functions/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# Ignore all
|
||||
**/*
|
||||
!.gitignore
|
||||
|
||||
# Keep custom functions
|
||||
!nvm.fish
|
||||
1
files/home/.config/nvim/.gitignore
vendored
Normal file
1
files/home/.config/nvim/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
plugged
|
||||
@@ -152,12 +152,17 @@ Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
|
||||
\ 'coc-perl',
|
||||
\ 'coc-prettier',
|
||||
\ 'coc-python',
|
||||
\ 'coc-react-refactor',
|
||||
\ 'coc-rust-analyzer',
|
||||
\ 'coc-sh',
|
||||
\ 'coc-snippets',
|
||||
\ 'coc-styled-components',
|
||||
\ 'coc-svg',
|
||||
\ 'coc-swagger',
|
||||
\ 'coc-tabnine',
|
||||
\ 'coc-toml',
|
||||
\ 'coc-tslint',
|
||||
\ 'coc-tslint-plugin',
|
||||
\ 'coc-tsserver',
|
||||
\ 'coc-vimlsp',
|
||||
\ 'coc-xml',
|
||||
@@ -165,6 +170,10 @@ Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
|
||||
\ ]
|
||||
" }}}
|
||||
|
||||
" ts
|
||||
Plug 'HerringtonDarkholme/yats.vim'
|
||||
Plug 'maxmellon/vim-jsx-pretty'
|
||||
|
||||
" elm
|
||||
Plug 'andys8/vim-elm-syntax'
|
||||
|
||||
@@ -6,35 +6,28 @@
|
||||
# << >> || \\,-.//
|
||||
# (__) (__)(_") (_/(__)
|
||||
#
|
||||
|
||||
# set PATH so it includes user's private bin
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
mkdir -p ~/.local/bin
|
||||
|
||||
# xdg data & config
|
||||
if [ -z "$XDG_DATA_HOME" ]; then
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
fi
|
||||
export XDG_DATA_HOME=${XDG_DATA_HOME:-"$HOME/.local/share"}
|
||||
mkdir -p "$XDG_DATA_HOME"
|
||||
if [ -z "$XDG_CONFIG_HOME" ]; then
|
||||
export XDG_CONFIG_HOME="$HOME/.config"
|
||||
fi
|
||||
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-"$HOME/.config"}
|
||||
mkdir -p "$XDG_CONFIG_HOME"
|
||||
|
||||
# workspace
|
||||
if [ -z "$WORKSPACE" ]; then
|
||||
export WORKSPACE="$HOME/workspace"
|
||||
fi
|
||||
export WORKSPACE=${WORKSPACE:-"$HOME/workspace"}
|
||||
mkdir -p "$WORKSPACE"
|
||||
|
||||
# dotfiles
|
||||
if [ -z "$DOTFILES" ]; then
|
||||
export DOTFILES="$HOME/.dotfiles"
|
||||
fi
|
||||
export DOTFILES=${DOTFILES:-"$HOME/.dotfiles"}
|
||||
|
||||
|
||||
# pyenv
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
export PATH="$PYENV_ROOT/shims:$PATH"
|
||||
if [ -d "$PYENV_ROOT" ]; then
|
||||
[ -x "$(command -v pyenv)" ] && eval "$(pyenv init -)"
|
||||
fi
|
||||
@@ -44,29 +37,31 @@ export POETRY_ROOT="$HOME/.poetry"
|
||||
export PATH="$POETRY_ROOT/bin:$PATH"
|
||||
|
||||
# nvm
|
||||
if [ -z "$NVM_DIR" ]; then
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
fi
|
||||
export NVM_DIR=${NVM_DIR:-"$HOME/.nvm"}
|
||||
mkdir -p "$NVM_DIR"
|
||||
export PATH="$NVM_DIR/bin:$PATH"
|
||||
|
||||
# node (default v14)
|
||||
node_alias="$NVM_DIR/alias/lts/fermium"
|
||||
if [ -f "$node_alias" ]; then
|
||||
VERSION=`cat $node_alias`
|
||||
export PATH="$NVM_DIR/versions/node/$VERSION/bin:$PATH"
|
||||
fi
|
||||
|
||||
# yarn
|
||||
export YARN_DIR="$HOME/.yarn"
|
||||
export YARN_DIR=${YARN_DIR:-"$HOME/.yarn"}
|
||||
mkdir -p "$YARN_DIR"
|
||||
export PATH="$YARN_DIR/bin:$PATH"
|
||||
|
||||
# editor
|
||||
export EDITOR="nvim"
|
||||
export VISUAL="nvim"
|
||||
|
||||
# fzf
|
||||
export FZF_DEFAULT_OPTS="--reverse"
|
||||
export FZF_DEFAULT_COMMAND='fdfind --type f --hidden --follow --exclude .git'
|
||||
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
||||
export FZF_COMPLETION_TRIGGER='**'
|
||||
# z (jump around)
|
||||
export Z_DATA_DIR=${Z_DATA:-"$XDG_DATA_HOME/z"}
|
||||
export Z_DATA=${Z_DATA:-"$Z_DATA_DIR/data"}
|
||||
export Z_OWNER=${Z_OWNER:-$USER}
|
||||
|
||||
# nix
|
||||
if [ -e ~/.nix-profile/etc/profile.d/nix.sh ]; then . ~/.nix-profile/etc/profile.d/nix.sh; fi
|
||||
if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then
|
||||
. $HOME/.nix-profile/etc/profile.d/nix.sh
|
||||
fi
|
||||
|
||||
# _ _ _ ____
|
||||
# U /"\ u |"| ___ U /"\ u / __"| u
|
||||
@@ -76,10 +71,5 @@ if [ -e ~/.nix-profile/etc/profile.d/nix.sh ]; then . ~/.nix-profile/etc/profile
|
||||
# \\ >> // \\.-,_|___|_,-.\\ >> )( (__)
|
||||
# (__) (__)(_")("_)\_)-' '-(_/(__) (__)(__)
|
||||
#
|
||||
alias vim='nvim'
|
||||
alias vi='vim'
|
||||
|
||||
alias bat='batcat'
|
||||
alias cat='bat'
|
||||
|
||||
alias j="z"
|
||||
alias fd=`which fdfind`
|
||||
573
files/home/.spacemacs
Normal file
573
files/home/.spacemacs
Normal file
@@ -0,0 +1,573 @@
|
||||
;; -*- mode: emacs-lisp; lexical-binding: t -*-
|
||||
;; This file is loaded by Spacemacs at startup.
|
||||
;; It must be stored in your home directory.
|
||||
|
||||
(defun dotspacemacs/layers ()
|
||||
"Layer configuration:
|
||||
This function should only modify configuration layer settings."
|
||||
(setq-default
|
||||
;; Base distribution to use. This is a layer contained in the directory
|
||||
;; `+distribution'. For now available distributions are `spacemacs-base'
|
||||
;; or `spacemacs'. (default 'spacemacs)
|
||||
dotspacemacs-distribution 'spacemacs
|
||||
|
||||
;; Lazy installation of layers (i.e. layers are installed only when a file
|
||||
;; with a supported type is opened). Possible values are `all', `unused'
|
||||
;; and `nil'. `unused' will lazy install only unused layers (i.e. layers
|
||||
;; not listed in variable `dotspacemacs-configuration-layers'), `all' will
|
||||
;; lazy install any layer that support lazy installation even the layers
|
||||
;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy
|
||||
;; installation feature and you have to explicitly list a layer in the
|
||||
;; variable `dotspacemacs-configuration-layers' to install it.
|
||||
;; (default 'unused)
|
||||
dotspacemacs-enable-lazy-installation 'unused
|
||||
|
||||
;; If non-nil then Spacemacs will ask for confirmation before installing
|
||||
;; a layer lazily. (default t)
|
||||
dotspacemacs-ask-for-lazy-installation t
|
||||
|
||||
;; List of additional paths where to look for configuration layers.
|
||||
;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
|
||||
dotspacemacs-configuration-layer-path '()
|
||||
|
||||
;; List of configuration layers to load.
|
||||
dotspacemacs-configuration-layers '(
|
||||
(typescript :variables
|
||||
typescript-backend 'lsp
|
||||
typescript-fmt-tool 'prettier)
|
||||
react
|
||||
javascript
|
||||
;; ----------------------------------------------------------------
|
||||
;; Example of useful layers you may want to use right away.
|
||||
;; Uncomment some layer names and press `SPC f e R' (Vim style) or
|
||||
;; `M-m f e R' (Emacs style) to install them.
|
||||
;; ----------------------------------------------------------------
|
||||
auto-completion
|
||||
better-defaults
|
||||
emacs-lisp
|
||||
git
|
||||
helm
|
||||
lsp
|
||||
markdown
|
||||
multiple-cursors
|
||||
org
|
||||
(shell :variables
|
||||
shell-default-height 30
|
||||
shell-default-position 'bottom
|
||||
shell-default-shell 'multi-term)
|
||||
spell-checking
|
||||
syntax-checking
|
||||
version-control
|
||||
treemacs)
|
||||
|
||||
|
||||
;; List of additional packages that will be installed without being wrapped
|
||||
;; in a layer (generally the packages are installed only and should still be
|
||||
;; loaded using load/require/use-package in the user-config section below in
|
||||
;; this file). If you need some configuration for these packages, then
|
||||
;; consider creating a layer. You can also put the configuration in
|
||||
;; `dotspacemacs/user-config'. To use a local version of a package, use the
|
||||
;; `:location' property: '(your-package :location "~/path/to/your-package/")
|
||||
;; Also include the dependencies as they will not be resolved automatically.
|
||||
dotspacemacs-additional-packages '()
|
||||
|
||||
;; A list of packages that cannot be updated.
|
||||
dotspacemacs-frozen-packages '()
|
||||
|
||||
;; A list of packages that will not be installed and loaded.
|
||||
dotspacemacs-excluded-packages '()
|
||||
|
||||
;; Defines the behaviour of Spacemacs when installing packages.
|
||||
;; Possible values are `used-only', `used-but-keep-unused' and `all'.
|
||||
;; `used-only' installs only explicitly used packages and deletes any unused
|
||||
;; packages as well as their unused dependencies. `used-but-keep-unused'
|
||||
;; installs only the used packages but won't delete unused ones. `all'
|
||||
;; installs *all* packages supported by Spacemacs and never uninstalls them.
|
||||
;; (default is `used-only')
|
||||
dotspacemacs-install-packages 'used-only))
|
||||
|
||||
(defun dotspacemacs/init ()
|
||||
"Initialization:
|
||||
This function is called at the very beginning of Spacemacs startup,
|
||||
before layer configuration.
|
||||
It should only modify the values of Spacemacs settings."
|
||||
;; This setq-default sexp is an exhaustive list of all the supported
|
||||
;; spacemacs settings.
|
||||
(setq-default
|
||||
;; If non-nil then enable support for the portable dumper. You'll need
|
||||
;; to compile Emacs 27 from source following the instructions in file
|
||||
;; EXPERIMENTAL.org at to root of the git repository.
|
||||
;; (default nil)
|
||||
dotspacemacs-enable-emacs-pdumper nil
|
||||
|
||||
;; Name of executable file pointing to emacs 27+. This executable must be
|
||||
;; in your PATH.
|
||||
;; (default "emacs")
|
||||
dotspacemacs-emacs-pdumper-executable-file "emacs"
|
||||
|
||||
;; Name of the Spacemacs dump file. This is the file will be created by the
|
||||
;; portable dumper in the cache directory under dumps sub-directory.
|
||||
;; To load it when starting Emacs add the parameter `--dump-file'
|
||||
;; when invoking Emacs 27.1 executable on the command line, for instance:
|
||||
;; ./emacs --dump-file=$HOME/.emacs.d/.cache/dumps/spacemacs-27.1.pdmp
|
||||
;; (default (format "spacemacs-%s.pdmp" emacs-version))
|
||||
dotspacemacs-emacs-dumper-dump-file (format "spacemacs-%s.pdmp" emacs-version)
|
||||
|
||||
;; If non-nil ELPA repositories are contacted via HTTPS whenever it's
|
||||
;; possible. Set it to nil if you have no way to use HTTPS in your
|
||||
;; environment, otherwise it is strongly recommended to let it set to t.
|
||||
;; This variable has no effect if Emacs is launched with the parameter
|
||||
;; `--insecure' which forces the value of this variable to nil.
|
||||
;; (default t)
|
||||
dotspacemacs-elpa-https t
|
||||
|
||||
;; Maximum allowed time in seconds to contact an ELPA repository.
|
||||
;; (default 5)
|
||||
dotspacemacs-elpa-timeout 5
|
||||
|
||||
;; Set `gc-cons-threshold' and `gc-cons-percentage' when startup finishes.
|
||||
;; This is an advanced option and should not be changed unless you suspect
|
||||
;; performance issues due to garbage collection operations.
|
||||
;; (default '(100000000 0.1))
|
||||
dotspacemacs-gc-cons '(100000000 0.1)
|
||||
|
||||
;; Set `read-process-output-max' when startup finishes.
|
||||
;; This defines how much data is read from a foreign process.
|
||||
;; Setting this >= 1 MB should increase performance for lsp servers
|
||||
;; in emacs 27.
|
||||
;; (default (* 1024 1024))
|
||||
dotspacemacs-read-process-output-max (* 1024 1024)
|
||||
|
||||
;; If non-nil then Spacelpa repository is the primary source to install
|
||||
;; a locked version of packages. If nil then Spacemacs will install the
|
||||
;; latest version of packages from MELPA. Spacelpa is currently in
|
||||
;; experimental state please use only for testing purposes.
|
||||
;; (default nil)
|
||||
dotspacemacs-use-spacelpa nil
|
||||
|
||||
;; If non-nil then verify the signature for downloaded Spacelpa archives.
|
||||
;; (default t)
|
||||
dotspacemacs-verify-spacelpa-archives t
|
||||
|
||||
;; If non-nil then spacemacs will check for updates at startup
|
||||
;; when the current branch is not `develop'. Note that checking for
|
||||
;; new versions works via git commands, thus it calls GitHub services
|
||||
;; whenever you start Emacs. (default nil)
|
||||
dotspacemacs-check-for-update nil
|
||||
|
||||
;; If non-nil, a form that evaluates to a package directory. For example, to
|
||||
;; use different package directories for different Emacs versions, set this
|
||||
;; to `emacs-version'. (default 'emacs-version)
|
||||
dotspacemacs-elpa-subdirectory 'emacs-version
|
||||
|
||||
;; One of `vim', `emacs' or `hybrid'.
|
||||
;; `hybrid' is like `vim' except that `insert state' is replaced by the
|
||||
;; `hybrid state' with `emacs' key bindings. The value can also be a list
|
||||
;; with `:variables' keyword (similar to layers). Check the editing styles
|
||||
;; section of the documentation for details on available variables.
|
||||
;; (default 'vim)
|
||||
dotspacemacs-editing-style 'hybrid
|
||||
|
||||
;; If non-nil show the version string in the Spacemacs buffer. It will
|
||||
;; appear as (spacemacs version)@(emacs version)
|
||||
;; (default t)
|
||||
dotspacemacs-startup-buffer-show-version t
|
||||
|
||||
;; Specify the startup banner. Default value is `official', it displays
|
||||
;; the official spacemacs logo. An integer value is the index of text
|
||||
;; banner, `random' chooses a random text banner in `core/banners'
|
||||
;; directory. A string value must be a path to an image format supported
|
||||
;; by your Emacs build.
|
||||
;; If the value is nil then no banner is displayed. (default 'official)
|
||||
dotspacemacs-startup-banner 'random
|
||||
|
||||
;; List of items to show in startup buffer or an association list of
|
||||
;; the form `(list-type . list-size)`. If nil then it is disabled.
|
||||
;; Possible values for list-type are:
|
||||
;; `recents' `recents-by-project' `bookmarks' `projects' `agenda' `todos'.
|
||||
;; List sizes may be nil, in which case
|
||||
;; `spacemacs-buffer-startup-lists-length' takes effect.
|
||||
;; The exceptional case is `recents-by-project', where list-type must be a
|
||||
;; pair of numbers, e.g. `(recents-by-project . (7 . 5))', where the first
|
||||
;; number is the project limit and the second the limit on the recent files
|
||||
;; within a project.
|
||||
dotspacemacs-startup-lists '((recents . 5)
|
||||
(projects . 7))
|
||||
|
||||
;; True if the home buffer should respond to resize events. (default t)
|
||||
dotspacemacs-startup-buffer-responsive t
|
||||
|
||||
;; The minimum delay in seconds between number key presses. (default 0.4)
|
||||
dotspacemacs-startup-buffer-multi-digit-delay 0.4
|
||||
|
||||
;; Default major mode for a new empty buffer. Possible values are mode
|
||||
;; names such as `text-mode'; and `nil' to use Fundamental mode.
|
||||
;; (default `text-mode')
|
||||
dotspacemacs-new-empty-buffer-major-mode 'text-mode
|
||||
|
||||
;; Default major mode of the scratch buffer (default `text-mode')
|
||||
dotspacemacs-scratch-mode 'text-mode
|
||||
|
||||
;; If non-nil, *scratch* buffer will be persistent. Things you write down in
|
||||
;; *scratch* buffer will be saved and restored automatically.
|
||||
dotspacemacs-scratch-buffer-persistent nil
|
||||
|
||||
;; If non-nil, `kill-buffer' on *scratch* buffer
|
||||
;; will bury it instead of killing.
|
||||
dotspacemacs-scratch-buffer-unkillable nil
|
||||
|
||||
;; Initial message in the scratch buffer, such as "Welcome to Spacemacs!"
|
||||
;; (default nil)
|
||||
dotspacemacs-initial-scratch-message nil
|
||||
|
||||
;; List of themes, the first of the list is loaded when spacemacs starts.
|
||||
;; Press `SPC T n' to cycle to the next theme in the list (works great
|
||||
;; with 2 themes variants, one dark and one light)
|
||||
dotspacemacs-themes '(spacemacs-dark
|
||||
spacemacs-light)
|
||||
|
||||
;; Set the theme for the Spaceline. Supported themes are `spacemacs',
|
||||
;; `all-the-icons', `custom', `doom', `vim-powerline' and `vanilla'. The
|
||||
;; first three are spaceline themes. `doom' is the doom-emacs mode-line.
|
||||
;; `vanilla' is default Emacs mode-line. `custom' is a user defined themes,
|
||||
;; refer to the DOCUMENTATION.org for more info on how to create your own
|
||||
;; spaceline theme. Value can be a symbol or list with additional properties.
|
||||
;; (default '(spacemacs :separator wave :separator-scale 1.5))
|
||||
dotspacemacs-mode-line-theme '(spacemacs :separator wave :separator-scale 1.5)
|
||||
|
||||
;; If non-nil the cursor color matches the state color in GUI Emacs.
|
||||
;; (default t)
|
||||
dotspacemacs-colorize-cursor-according-to-state t
|
||||
|
||||
;; Default font or prioritized list of fonts. The `:size' can be specified as
|
||||
;; a non-negative integer (pixel size), or a floating-point (point size).
|
||||
;; Point size is recommended, because it's device independent. (default 10.0)
|
||||
dotspacemacs-default-font '("Source Code Pro"
|
||||
:size 10.0
|
||||
:weight normal
|
||||
:width normal)
|
||||
|
||||
;; The leader key (default "SPC")
|
||||
dotspacemacs-leader-key "SPC"
|
||||
|
||||
;; The key used for Emacs commands `M-x' (after pressing on the leader key).
|
||||
;; (default "SPC")
|
||||
dotspacemacs-emacs-command-key "SPC"
|
||||
|
||||
;; The key used for Vim Ex commands (default ":")
|
||||
dotspacemacs-ex-command-key ":"
|
||||
|
||||
;; The leader key accessible in `emacs state' and `insert state'
|
||||
;; (default "M-m")
|
||||
dotspacemacs-emacs-leader-key "M-m"
|
||||
|
||||
;; Major mode leader key is a shortcut key which is the equivalent of
|
||||
;; pressing `<leader> m`. Set it to `nil` to disable it. (default ",")
|
||||
dotspacemacs-major-mode-leader-key ","
|
||||
|
||||
;; Major mode leader key accessible in `emacs state' and `insert state'.
|
||||
;; (default "C-M-m" for terminal mode, "<M-return>" for GUI mode).
|
||||
;; Thus M-RET should work as leader key in both GUI and terminal modes.
|
||||
;; C-M-m also should work in terminal mode, but not in GUI mode.
|
||||
dotspacemacs-major-mode-emacs-leader-key (if window-system "<M-return>" "C-M-m")
|
||||
|
||||
;; These variables control whether separate commands are bound in the GUI to
|
||||
;; the key pairs `C-i', `TAB' and `C-m', `RET'.
|
||||
;; Setting it to a non-nil value, allows for separate commands under `C-i'
|
||||
;; and TAB or `C-m' and `RET'.
|
||||
;; In the terminal, these pairs are generally indistinguishable, so this only
|
||||
;; works in the GUI. (default nil)
|
||||
dotspacemacs-distinguish-gui-tab nil
|
||||
|
||||
;; Name of the default layout (default "Default")
|
||||
dotspacemacs-default-layout-name "Default"
|
||||
|
||||
;; If non-nil the default layout name is displayed in the mode-line.
|
||||
;; (default nil)
|
||||
dotspacemacs-display-default-layout nil
|
||||
|
||||
;; If non-nil then the last auto saved layouts are resumed automatically upon
|
||||
;; start. (default nil)
|
||||
dotspacemacs-auto-resume-layouts nil
|
||||
|
||||
;; If non-nil, auto-generate layout name when creating new layouts. Only has
|
||||
;; effect when using the "jump to layout by number" commands. (default nil)
|
||||
dotspacemacs-auto-generate-layout-names nil
|
||||
|
||||
;; Size (in MB) above which spacemacs will prompt to open the large file
|
||||
;; literally to avoid performance issues. Opening a file literally means that
|
||||
;; no major mode or minor modes are active. (default is 1)
|
||||
dotspacemacs-large-file-size 1
|
||||
|
||||
;; Location where to auto-save files. Possible values are `original' to
|
||||
;; auto-save the file in-place, `cache' to auto-save the file to another
|
||||
;; file stored in the cache directory and `nil' to disable auto-saving.
|
||||
;; (default 'cache)
|
||||
dotspacemacs-auto-save-file-location 'cache
|
||||
|
||||
;; Maximum number of rollback slots to keep in the cache. (default 5)
|
||||
dotspacemacs-max-rollback-slots 5
|
||||
|
||||
;; If non-nil, the paste transient-state is enabled. While enabled, after you
|
||||
;; paste something, pressing `C-j' and `C-k' several times cycles through the
|
||||
;; elements in the `kill-ring'. (default nil)
|
||||
dotspacemacs-enable-paste-transient-state nil
|
||||
|
||||
;; Which-key delay in seconds. The which-key buffer is the popup listing
|
||||
;; the commands bound to the current keystroke sequence. (default 0.4)
|
||||
dotspacemacs-which-key-delay 0.4
|
||||
|
||||
;; Which-key frame position. Possible values are `right', `bottom' and
|
||||
;; `right-then-bottom'. right-then-bottom tries to display the frame to the
|
||||
;; right; if there is insufficient space it displays it at the bottom.
|
||||
;; (default 'bottom)
|
||||
dotspacemacs-which-key-position 'bottom
|
||||
|
||||
;; Control where `switch-to-buffer' displays the buffer. If nil,
|
||||
;; `switch-to-buffer' displays the buffer in the current window even if
|
||||
;; another same-purpose window is available. If non-nil, `switch-to-buffer'
|
||||
;; displays the buffer in a same-purpose window even if the buffer can be
|
||||
;; displayed in the current window. (default nil)
|
||||
dotspacemacs-switch-to-buffer-prefers-purpose nil
|
||||
|
||||
;; If non-nil a progress bar is displayed when spacemacs is loading. This
|
||||
;; may increase the boot time on some systems and emacs builds, set it to
|
||||
;; nil to boost the loading time. (default t)
|
||||
dotspacemacs-loading-progress-bar nil
|
||||
|
||||
;; If non-nil the frame is fullscreen when Emacs starts up. (default nil)
|
||||
;; (Emacs 24.4+ only)
|
||||
dotspacemacs-fullscreen-at-startup nil
|
||||
|
||||
;; If non-nil `spacemacs/toggle-fullscreen' will not use native fullscreen.
|
||||
;; Use to disable fullscreen animations in OSX. (default nil)
|
||||
dotspacemacs-fullscreen-use-non-native nil
|
||||
|
||||
;; If non-nil the frame is maximized when Emacs starts up.
|
||||
;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.
|
||||
;; (default nil) (Emacs 24.4+ only)
|
||||
dotspacemacs-maximized-at-startup nil
|
||||
|
||||
;; If non-nil the frame is undecorated when Emacs starts up. Combine this
|
||||
;; variable with `dotspacemacs-maximized-at-startup' in OSX to obtain
|
||||
;; borderless fullscreen. (default nil)
|
||||
dotspacemacs-undecorated-at-startup nil
|
||||
|
||||
;; A value from the range (0..100), in increasing opacity, which describes
|
||||
;; the transparency level of a frame when it's active or selected.
|
||||
;; Transparency can be toggled through `toggle-transparency'. (default 90)
|
||||
dotspacemacs-active-transparency 90
|
||||
|
||||
;; A value from the range (0..100), in increasing opacity, which describes
|
||||
;; the transparency level of a frame when it's inactive or deselected.
|
||||
;; Transparency can be toggled through `toggle-transparency'. (default 90)
|
||||
dotspacemacs-inactive-transparency 90
|
||||
|
||||
;; If non-nil show the titles of transient states. (default t)
|
||||
dotspacemacs-show-transient-state-title t
|
||||
|
||||
;; If non-nil show the color guide hint for transient state keys. (default t)
|
||||
dotspacemacs-show-transient-state-color-guide t
|
||||
|
||||
;; If non-nil unicode symbols are displayed in the mode line.
|
||||
;; If you use Emacs as a daemon and wants unicode characters only in GUI set
|
||||
;; the value to quoted `display-graphic-p'. (default t)
|
||||
dotspacemacs-mode-line-unicode-symbols t
|
||||
|
||||
;; If non-nil smooth scrolling (native-scrolling) is enabled. Smooth
|
||||
;; scrolling overrides the default behavior of Emacs which recenters point
|
||||
;; when it reaches the top or bottom of the screen. (default t)
|
||||
dotspacemacs-smooth-scrolling t
|
||||
|
||||
;; Show the scroll bar while scrolling. The auto hide time can be configured
|
||||
;; by setting this variable to a number. (default t)
|
||||
dotspacemacs-scroll-bar-while-scrolling t
|
||||
|
||||
;; Control line numbers activation.
|
||||
;; If set to `t', `relative' or `visual' then line numbers are enabled in all
|
||||
;; `prog-mode' and `text-mode' derivatives. If set to `relative', line
|
||||
;; numbers are relative. If set to `visual', line numbers are also relative,
|
||||
;; but lines are only visual lines are counted. For example, folded lines
|
||||
;; will not be counted and wrapped lines are counted as multiple lines.
|
||||
;; This variable can also be set to a property list for finer control:
|
||||
;; '(:relative nil
|
||||
;; :visual nil
|
||||
;; :disabled-for-modes dired-mode
|
||||
;; doc-view-mode
|
||||
;; markdown-mode
|
||||
;; org-mode
|
||||
;; pdf-view-mode
|
||||
;; text-mode
|
||||
;; :size-limit-kb 1000)
|
||||
;; When used in a plist, `visual' takes precedence over `relative'.
|
||||
;; (default nil)
|
||||
dotspacemacs-line-numbers 'relative
|
||||
|
||||
;; Code folding method. Possible values are `evil', `origami' and `vimish'.
|
||||
;; (default 'evil)
|
||||
dotspacemacs-folding-method 'evil
|
||||
|
||||
;; If non-nil and `dotspacemacs-activate-smartparens-mode' is also non-nil,
|
||||
;; `smartparens-strict-mode' will be enabled in programming modes.
|
||||
;; (default nil)
|
||||
dotspacemacs-smartparens-strict-mode nil
|
||||
|
||||
;; If non-nil smartparens-mode will be enabled in programming modes.
|
||||
;; (default t)
|
||||
dotspacemacs-activate-smartparens-mode t
|
||||
|
||||
;; If non-nil pressing the closing parenthesis `)' key in insert mode passes
|
||||
;; over any automatically added closing parenthesis, bracket, quote, etc...
|
||||
;; This can be temporary disabled by pressing `C-q' before `)'. (default nil)
|
||||
dotspacemacs-smart-closing-parenthesis nil
|
||||
|
||||
;; Select a scope to highlight delimiters. Possible values are `any',
|
||||
;; `current', `all' or `nil'. Default is `all' (highlight any scope and
|
||||
;; emphasis the current one). (default 'all)
|
||||
dotspacemacs-highlight-delimiters 'all
|
||||
|
||||
;; If non-nil, start an Emacs server if one is not already running.
|
||||
;; (default nil)
|
||||
dotspacemacs-enable-server nil
|
||||
|
||||
;; Set the emacs server socket location.
|
||||
;; If nil, uses whatever the Emacs default is, otherwise a directory path
|
||||
;; like \"~/.emacs.d/server\". It has no effect if
|
||||
;; `dotspacemacs-enable-server' is nil.
|
||||
;; (default nil)
|
||||
dotspacemacs-server-socket-dir nil
|
||||
|
||||
;; If non-nil, advise quit functions to keep server open when quitting.
|
||||
;; (default nil)
|
||||
dotspacemacs-persistent-server nil
|
||||
|
||||
;; List of search tool executable names. Spacemacs uses the first installed
|
||||
;; tool of the list. Supported tools are `rg', `ag', `pt', `ack' and `grep'.
|
||||
;; (default '("rg" "ag" "pt" "ack" "grep"))
|
||||
dotspacemacs-search-tools '("rg" "ag" "pt" "ack" "grep")
|
||||
|
||||
;; Format specification for setting the frame title.
|
||||
;; %a - the `abbreviated-file-name', or `buffer-name'
|
||||
;; %t - `projectile-project-name'
|
||||
;; %I - `invocation-name'
|
||||
;; %S - `system-name'
|
||||
;; %U - contents of $USER
|
||||
;; %b - buffer name
|
||||
;; %f - visited file name
|
||||
;; %F - frame name
|
||||
;; %s - process status
|
||||
;; %p - percent of buffer above top of window, or Top, Bot or All
|
||||
;; %P - percent of buffer above bottom of window, perhaps plus Top, or Bot or All
|
||||
;; %m - mode name
|
||||
;; %n - Narrow if appropriate
|
||||
;; %z - mnemonics of buffer, terminal, and keyboard coding systems
|
||||
;; %Z - like %z, but including the end-of-line format
|
||||
;; If nil then Spacemacs uses default `frame-title-format' to avoid
|
||||
;; performance issues, instead of calculating the frame title by
|
||||
;; `spacemacs/title-prepare' all the time.
|
||||
;; (default "%I@%S")
|
||||
dotspacemacs-frame-title-format "%I@%S"
|
||||
|
||||
;; Format specification for setting the icon title format
|
||||
;; (default nil - same as frame-title-format)
|
||||
dotspacemacs-icon-title-format nil
|
||||
|
||||
;; Show trailing whitespace (default t)
|
||||
dotspacemacs-show-trailing-whitespace t
|
||||
|
||||
;; Delete whitespace while saving buffer. Possible values are `all'
|
||||
;; to aggressively delete empty line and long sequences of whitespace,
|
||||
;; `trailing' to delete only the whitespace at end of lines, `changed' to
|
||||
;; delete only whitespace for changed lines or `nil' to disable cleanup.
|
||||
;; (default nil)
|
||||
dotspacemacs-whitespace-cleanup nil
|
||||
|
||||
;; If non nil activate `clean-aindent-mode' which tries to correct
|
||||
;; virtual indentation of simple modes. This can interfer with mode specific
|
||||
;; indent handling like has been reported for `go-mode'.
|
||||
;; If it does deactivate it here.
|
||||
;; (default t)
|
||||
dotspacemacs-use-clean-aindent-mode t
|
||||
|
||||
;; If non-nil shift your number row to match the entered keyboard layout
|
||||
;; (only in insert state). Currently supported keyboard layouts are:
|
||||
;; `qwerty-us', `qwertz-de' and `querty-ca-fr'.
|
||||
;; New layouts can be added in `spacemacs-editing' layer.
|
||||
;; (default nil)
|
||||
dotspacemacs-swap-number-row nil
|
||||
|
||||
;; Either nil or a number of seconds. If non-nil zone out after the specified
|
||||
;; number of seconds. (default nil)
|
||||
dotspacemacs-zone-out-when-idle nil
|
||||
|
||||
;; Run `spacemacs/prettify-org-buffer' when
|
||||
;; visiting README.org files of Spacemacs.
|
||||
;; (default nil)
|
||||
dotspacemacs-pretty-docs nil
|
||||
|
||||
;; If nil the home buffer shows the full path of agenda items
|
||||
;; and todos. If non nil only the file name is shown.
|
||||
dotspacemacs-home-shorten-agenda-source nil
|
||||
|
||||
;; If non-nil then byte-compile some of Spacemacs files.
|
||||
dotspacemacs-byte-compile nil))
|
||||
|
||||
(defun dotspacemacs/user-env ()
|
||||
"Environment variables setup.
|
||||
This function defines the environment variables for your Emacs session. By
|
||||
default it calls `spacemacs/load-spacemacs-env' which loads the environment
|
||||
variables declared in `~/.spacemacs.env' or `~/.spacemacs.d/.spacemacs.env'.
|
||||
See the header of this file for more information."
|
||||
(spacemacs/load-spacemacs-env))
|
||||
|
||||
(defun dotspacemacs/user-init ()
|
||||
"Initialization for user code:
|
||||
This function is called immediately after `dotspacemacs/init', before layer
|
||||
configuration.
|
||||
It is mostly for variables that should be set before packages are loaded.
|
||||
If you are unsure, try setting them in `dotspacemacs/user-config' first.")
|
||||
|
||||
|
||||
(defun dotspacemacs/user-load ()
|
||||
"Library to load while dumping.
|
||||
This function is called only while dumping Spacemacs configuration. You can
|
||||
`require' or `load' the libraries of your choice that will be included in the
|
||||
dump.")
|
||||
|
||||
|
||||
(defun dotspacemacs/user-config ()
|
||||
"Configuration for user code:
|
||||
This function is called at the very end of Spacemacs startup, after layer
|
||||
configuration.
|
||||
Put your configuration code here, except for variables that should be set
|
||||
before packages are loaded.")
|
||||
|
||||
|
||||
;; Do not write anything past this comment. This is where Emacs will
|
||||
;; auto-generate custom variable definitions.
|
||||
(defun dotspacemacs/emacs-custom-settings ()
|
||||
"Emacs custom settings.
|
||||
This is an auto-generated function, do not modify its content directly, use
|
||||
Emacs customize menu instead.
|
||||
This function is called at the very end of Spacemacs initialization."
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(ansi-color-faces-vector
|
||||
[default default default italic underline success warning error])
|
||||
'(custom-enabled-themes '(spacemacs-dark))
|
||||
'(custom-safe-themes
|
||||
'("bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" default))
|
||||
'(evil-want-Y-yank-to-eol nil)
|
||||
'(package-selected-packages
|
||||
'(yasnippet-snippets xterm-color vterm unfill treemacs-magit terminal-here smeargle shell-pop orgit-forge orgit org-rich-yank org-projectile org-category-capture org-present org-pomodoro alert log4e gntp org-mime org-download org-cliplink org-brain mwim multi-term mmm-mode markdown-toc magit-section lsp-ui lsp-origami origami helm-org-rifle helm-lsp helm-gitignore helm-git-grep helm-company helm-c-yasnippet gnuplot gitignore-templates gitignore-mode gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link git-gutter-fringe+ fringe-helper git-gutter+ gh-md fuzzy forge magit ghub closql emacsql-sqlite emacsql treepy git-commit with-editor transient flyspell-correct-helm flyspell-correct flycheck-pos-tip pos-tip evil-org eshell-z eshell-prompt-extras esh-help browse-at-remote auto-yasnippet auto-dictionary ac-ispell auto-complete tide web-mode typescript-mode rjsx-mode emmet-mode web-beautify tern prettier-js npm-mode nodejs-repl livid-mode skewer-mode js2-refactor yasnippet multiple-cursors js2-mode js-doc import-js grizzl impatient-mode htmlize simple-httpd helm-gtags ggtags dap-mode lsp-treemacs bui lsp-mode markdown-mode counsel-gtags counsel swiper ivy company add-node-modules-path ws-butler writeroom-mode winum which-key volatile-highlights vi-tilde-fringe uuidgen use-package undo-tree treemacs-projectile treemacs-persp treemacs-icons-dired treemacs-evil toc-org symon symbol-overlay string-inflection string-edit spaceline-all-the-icons restart-emacs request rainbow-delimiters quickrun popwin pcre2el password-generator paradox overseer org-superstar open-junk-file nameless multi-line macrostep lorem-ipsum link-hint indent-guide hybrid-mode hungry-delete hl-todo highlight-parentheses highlight-numbers highlight-indentation helm-xref helm-themes helm-swoop helm-purpose helm-projectile helm-org helm-mode-manager helm-make helm-ls-git helm-flx helm-descbinds helm-ag google-translate golden-ratio font-lock+ flycheck-package flycheck-elsa flx-ido fancy-battery eyebrowse expand-region evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-textobj-line evil-surround evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state evil-lion evil-indent-plus evil-iedit-state evil-goggles evil-exchange evil-escape evil-ediff evil-easymotion evil-collection evil-cleverparens evil-args evil-anzu eval-sexp-fu emr elisp-slime-nav editorconfig dumb-jump drag-stuff dotenv-mode dired-quick-sort diminish devdocs define-word column-enforce-mode clean-aindent-mode centered-cursor-mode auto-highlight-symbol auto-compile aggressive-indent ace-link ace-jump-helm-line))
|
||||
'(show-paren-mode t))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
)
|
||||
)
|
||||
62
install.pl
62
install.pl
@@ -1,62 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use warnings;
|
||||
use autodie;
|
||||
|
||||
use File::Basename;
|
||||
|
||||
# Prevent running as root
|
||||
if ($< == 0) {
|
||||
print "Failed: Running as root. Please run as user, not sudo\n";
|
||||
exit (1);
|
||||
}
|
||||
|
||||
my $dir = dirname(__FILE__);
|
||||
|
||||
my $log_target = $ENV{'LOG_TARGET'} // '';
|
||||
my $log_path = '';
|
||||
if ($log_target ne 'STDOUT') {
|
||||
# Generate unique logfile
|
||||
my $log_dir = "$dir/logs";
|
||||
`mkdir -p $log_dir`;
|
||||
my $uuid = `uuidgen`;
|
||||
chomp $uuid;
|
||||
$log_path = "$log_dir/$uuid.log";
|
||||
}
|
||||
print "Logs: $log_path\n";
|
||||
|
||||
# Execute given command and log appropriately
|
||||
# @arg 0 command to run
|
||||
sub log_execute {
|
||||
my $command = $log_path ne ''
|
||||
? "$_[0] >> $log_path 2>&1"
|
||||
: $_[0];
|
||||
system($command) == 0
|
||||
or die "system $command failed: $?";
|
||||
}
|
||||
|
||||
|
||||
# Ensure dependencies installed
|
||||
log_execute("sudo apt-get update -qqy && sudo apt-get install -qqy build-essential liblocal-lib-perl cpanminus stow");
|
||||
|
||||
# Bootstrap files
|
||||
log_execute("make -C $dir");
|
||||
|
||||
# Read scripts to be installed
|
||||
my $install_dir = "$dir/install";
|
||||
print "Installing $install_dir\n";
|
||||
opendir($dir, $install_dir) or die "Could not open $install_dir\n";
|
||||
my @files = readdir($dir);
|
||||
closedir($dir);
|
||||
@files = grep(/^\d{2}-.*\.sh$/, @files);
|
||||
@files = sort { lc($a) cmp lc($b) } @files;
|
||||
|
||||
# Install selected targets
|
||||
my $target = $ENV{'TARGET'} // 'all';
|
||||
if ($target ne 'all') {
|
||||
@files = grep(/${target}/, @files);
|
||||
}
|
||||
foreach my $file (@files) {
|
||||
print "Running $file...\r";
|
||||
log_execute("$install_dir/$file");
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
apt-transport-https
|
||||
bat
|
||||
curl
|
||||
cowsay
|
||||
fd-find
|
||||
fortune-mod
|
||||
git
|
||||
gnupg2
|
||||
jq
|
||||
make
|
||||
neovim
|
||||
net-tools
|
||||
openssh-client
|
||||
openssh-server
|
||||
ripgrep
|
||||
ruby-full
|
||||
software-properties-common
|
||||
tmux
|
||||
universal-ctags
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
clean
|
||||
update
|
||||
upgrade
|
||||
echo "apt cleaned, updated, upgraded"
|
||||
|
||||
package_list_file="$install_dir/00-apt-pkglist"
|
||||
install_file "$package_list_file"
|
||||
echo "list of dependencies installed"
|
||||
|
||||
cat /etc/os-release
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "fish"; then
|
||||
echo "installing fish..."
|
||||
add_ppa "fish-shell/release-3"
|
||||
update
|
||||
install fish
|
||||
fi
|
||||
|
||||
echo "fish is installed"
|
||||
fish --version
|
||||
|
||||
fisher_location="$XDG_CONFIG_HOME/fish/functions/fisher.fish"
|
||||
if ! [ -f "$fisher_location" ]; then
|
||||
echo "Installing fisher..."
|
||||
curl https://git.io/fisher --create-dirs -sLo "$fisher_location"
|
||||
fi
|
||||
echo "fisher is installed, updating..."
|
||||
fish -c "fisher update";
|
||||
|
||||
fish -c "fisher --version"
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# pyenv is installed
|
||||
if not_installed "pyenv"; then
|
||||
|
||||
echo "Installing pyenv..."
|
||||
|
||||
# Install pyenv prerequisites
|
||||
# see https://github.com/pyenv/pyenv/wiki/common-build-problems
|
||||
pyenv_list_file="$install_dir/10-pyenv-pkglist"
|
||||
install_file "$pyenv_list_file"
|
||||
|
||||
# Install pyenv
|
||||
# see https://github.com/pyenv/pyenv-installer
|
||||
run "https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" \
|
||||
"bash"
|
||||
|
||||
fi
|
||||
echo "pyenv is installed, upgrading $PYENV_ROOT..."
|
||||
git --git-dir="$PYENV_ROOT/.git" fetch -q
|
||||
git --git-dir="$PYENV_ROOT/.git" rebase -q --autostash FETCH_HEAD
|
||||
|
||||
pyenv --version
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
|
||||
# python3 and pip3 are installed
|
||||
if not_installed "pip3"; then
|
||||
|
||||
echo "Installing python3 and pip3..."
|
||||
|
||||
pyenv install 3.7.0
|
||||
pyenv global 3.7.0
|
||||
refresh
|
||||
|
||||
fi
|
||||
echo "python3 and pip3 are installed, upgrading..."
|
||||
pip install --upgrade pip
|
||||
pip3 install --upgrade pip
|
||||
python3 --version
|
||||
pip3 --version
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
|
||||
# poetry is installed
|
||||
if not_installed "poetry"; then
|
||||
|
||||
printf "Installing poetry...\n"
|
||||
|
||||
# Install poetry
|
||||
pip3 install --user poetry
|
||||
|
||||
fi
|
||||
printf "poetry is installed, upgrading...\n"
|
||||
pip3 install --upgrade poetry
|
||||
poetry --version
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# nvm is installed
|
||||
if not_installed "nvm"; then
|
||||
|
||||
printf "Installing nvm...\n"
|
||||
|
||||
# Install nvm
|
||||
mkdir -p $NVM_DIR
|
||||
run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh" \
|
||||
"bash"
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
nvm alias default node
|
||||
nvm install node
|
||||
|
||||
fi
|
||||
|
||||
printf "nvm is installed, upgrading...\n"
|
||||
run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh" \
|
||||
"bash"
|
||||
|
||||
nvm --version
|
||||
nvm use node
|
||||
node --version
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# yarn is installed
|
||||
if not_installed "yarn"; then
|
||||
|
||||
echo "Installing yarn..."
|
||||
|
||||
# Install yarn
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
update
|
||||
sudo apt install --no-install-recommends yarn
|
||||
|
||||
fi
|
||||
|
||||
echo "yarn is installed"
|
||||
# yarn --version
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "java"; then
|
||||
echo "Installing java..."
|
||||
install default-jre
|
||||
fi
|
||||
|
||||
echo "java is installed"
|
||||
java --version
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
|
||||
mkdir -p "$XDG_DATA_HOME/nvim/backup"
|
||||
plug_target="$XDG_DATA_HOME/nvim/site/autoload/plug.vim"
|
||||
if [ ! -f $plug_target ]; then
|
||||
echo "Downloading vim-plug to $plug_target";
|
||||
curl -fLo "$plug_target" --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
fi
|
||||
|
||||
echo "Installing neovim support";
|
||||
pip3 install --user neovim pynvim 'python-language-server[all]'
|
||||
nvm use default
|
||||
npm install -g neovim
|
||||
sudo gem install neovim
|
||||
|
||||
echo "Running PlugInstall";
|
||||
nvim --headless +UpdateRemotePlugins +PlugClean! +PlugInstall +PlugUpgrade +PlugUpdate +qall
|
||||
nvim --version
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "elm"; then
|
||||
# Download the 0.19.1 binary for Linux.
|
||||
#
|
||||
# +-----------+----------------------+
|
||||
# | FLAG | MEANING |
|
||||
# +-----------+----------------------+
|
||||
# | -L | follow redirects |
|
||||
# | -o elm.gz | name the file elm.gz |
|
||||
# +-----------+----------------------+
|
||||
#
|
||||
curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz
|
||||
|
||||
# There should now be a file named `elm.gz` on your Desktop.
|
||||
#
|
||||
# The downloaded file is compressed to make it faster to download.
|
||||
# This next command decompresses it, replacing `elm.gz` with `elm`.
|
||||
#
|
||||
gunzip elm.gz
|
||||
|
||||
# There should now be a file named `elm` on your Desktop!
|
||||
#
|
||||
# Every file has "permissions" about whether it can be read, written, or executed.
|
||||
# So before we use this file, we need to mark this file as executable:
|
||||
#
|
||||
chmod +x elm
|
||||
|
||||
# The `elm` file is now executable. That means running `~/Desktop/elm --help`
|
||||
# should work. Saying `./elm --help` works the same.
|
||||
#
|
||||
# But we want to be able to say `elm --help` without specifying the full file
|
||||
# path every time. We can do this by moving the `elm` binary to one of the
|
||||
# directories listed in your `PATH` environment variable:
|
||||
#
|
||||
sudo mv elm /usr/local/bin/
|
||||
rm {elm,elm.gz}
|
||||
fi
|
||||
|
||||
npm install -g @elm-tooling/elm-language-server elm-format elm-test
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# docker is installed
|
||||
DOCKER_FOLDER="$HOME/.docker"
|
||||
if not_installed "docker"; then
|
||||
|
||||
printf "Installing docker...\n"
|
||||
|
||||
# Create folder
|
||||
mkdir -p "$DOCKER_FOLDER"
|
||||
|
||||
# Requirements
|
||||
install apt-transport-https ca-certificates curl gnupg-agent \
|
||||
software-properties-common
|
||||
|
||||
# Add repository
|
||||
distro=$(lsb_release -si | tr '[:upper:]' '[:lower:]') # cast to lowercase
|
||||
add_key "https://download.docker.com/linux/$distro/gpg" "docker-apt-key"
|
||||
sudo add-apt-repository -y \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/$distro \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
update
|
||||
|
||||
# Install
|
||||
install docker-ce
|
||||
|
||||
# Chown
|
||||
sudo chown "$USER":"$USER" "$DOCKER_FOLDER" -R
|
||||
sudo chmod g+rwx "$DOCKER_FOLDER" -R
|
||||
|
||||
fi
|
||||
printf "docker is installed\n"
|
||||
docker --version
|
||||
|
||||
# docker-compose if installed
|
||||
if not_installed "docker-compose"; then
|
||||
|
||||
printf "Installing docker-compose...\n"
|
||||
|
||||
# Docker-compose
|
||||
pip3 install --user docker-compose
|
||||
|
||||
fi
|
||||
printf "docker-compose is installed, upgrading\n"
|
||||
pip3 install --upgrade docker-compose
|
||||
docker-compose --version
|
||||
|
||||
# docker group exists
|
||||
readonly docker_group='docker'
|
||||
if ! grep -q "$docker_group" /etc/group; then
|
||||
sudo groupadd "$docker_group"
|
||||
fi
|
||||
printf "group '$docker_group' is created\n"
|
||||
|
||||
# user is in docker group
|
||||
if ! groups "$USER" | grep -q "\b$docker_group\b"; then
|
||||
sudo usermod -aG docker "$USER"
|
||||
fi
|
||||
printf "user '$USER' is in '$docker_group' group\n"
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "gcloud"; then
|
||||
echo "Installing gcloud..."
|
||||
# Add the Cloud SDK distribution URI as a package source
|
||||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||
# Import the Google Cloud Platform public key
|
||||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
|
||||
update
|
||||
install google-cloud-sdk
|
||||
refresh
|
||||
fi
|
||||
|
||||
gcloud --version
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "firebase"; then
|
||||
echo "Installing firebase..."
|
||||
run "https://firebase.tools" "bash"
|
||||
fi
|
||||
|
||||
echo "firebase is installed, upgrading..."
|
||||
curl -sL firebase.tools | upgrade=true bash
|
||||
firebase --version
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
||||
temp_dir=$(mktemp -d)
|
||||
unzip awscliv2.zip -d "$temp_dir"
|
||||
rm awscliv2.zip
|
||||
|
||||
if not_installed "aws"; then
|
||||
echo "Installing awscli..."
|
||||
sudo $temp_dir/aws/install
|
||||
fi
|
||||
|
||||
echo "awscli is installed, upgrading..."
|
||||
sudo $temp_dir/aws/install --update
|
||||
aws --version
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
tf_version="0.14.6"
|
||||
if not_installed "terraform"; then
|
||||
echo "Installing terraform..."
|
||||
tf_archive="terraform_${tf_version}_linux_amd64.zip"
|
||||
wget "https://releases.hashicorp.com/terraform/${tf_version}/${tf_archive}"
|
||||
unzip "$tf_archive" -d "$dotfiles_dir/tmp"
|
||||
rm "$tf_archive"
|
||||
mkdir -p ~/.local/bin
|
||||
mv "$dotfiles_dir/tmp/terraform" ~/.local/bin
|
||||
rm "$dotfiles_dir/tmp/terraform"
|
||||
fi
|
||||
|
||||
echo "terraform is installed"
|
||||
terraform --version
|
||||
|
||||
tf_lsp_version="0.13.0"
|
||||
if not_installed "terraform-ls"; then
|
||||
echo "Installing terraform-ls..."
|
||||
tf_lsp_archive="terraform-ls_${tf_lsp_version}_linux_amd64.zip"
|
||||
wget "https://releases.hashicorp.com/terraform-ls/${tf_lsp_version}/${tf_lsp_archive}"
|
||||
unzip "${tf_lsp_archive}" -d "$dotfiles_dir/tmp"
|
||||
rm "${tf_lsp_archive}"
|
||||
mkdir -p ~/.local/bin
|
||||
mv "$dotfiles_dir/tmp/terraform-ls" ~/.local/bin
|
||||
rm "$dotfiles_dir/tmp/terraform-ls"
|
||||
fi
|
||||
|
||||
echo "terraform-lsp is installed"
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "kubectl"; then
|
||||
echo "Installing kubectl..."
|
||||
sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2
|
||||
|
||||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
||||
|
||||
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
|
||||
|
||||
update
|
||||
|
||||
install kubectl
|
||||
refresh
|
||||
fi
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
echo "cleaning"
|
||||
clean
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "screenfetch"; then
|
||||
echo "Installing screenfetch..."
|
||||
install screenfetch
|
||||
fi
|
||||
|
||||
echo "screenfetch is installed"
|
||||
screenfetch --version
|
||||
screenfetch
|
||||
112
install/utils.sh
112
install/utils.sh
@@ -1,112 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Helper functions
|
||||
# ---------------------------------------------------------------------------- #
|
||||
clean() {
|
||||
sudo apt-get clean
|
||||
}
|
||||
|
||||
update() {
|
||||
sudo apt-get update
|
||||
}
|
||||
|
||||
# Non-interactive upgrade
|
||||
upgrade() {
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
sudo apt-get \
|
||||
-o Dpkg::Options::="--force-confdef" \
|
||||
-o Dpkg::Options::="--force-confold" \
|
||||
-y \
|
||||
dist-upgrade
|
||||
sudo apt-get -y autoremove
|
||||
}
|
||||
|
||||
# @arg $1 packages to install
|
||||
install() {
|
||||
sudo apt-get install -qqy $1
|
||||
refresh
|
||||
}
|
||||
|
||||
# @arg $1 package list file to install
|
||||
install_file() {
|
||||
sudo apt-get install -qqyf $(cat $1)
|
||||
refresh
|
||||
}
|
||||
|
||||
# @arg $1 repository to add
|
||||
add_ppa() {
|
||||
sudo add-apt-repository -y ppa:$1
|
||||
}
|
||||
|
||||
# @arg $1 url to add
|
||||
# @arg $2 keyring to add to
|
||||
add_key() {
|
||||
curl -fsSL $1 | sudo apt-key --keyring "/etc/apt/trusted.gpg.d/$2.gpg" add
|
||||
}
|
||||
|
||||
# @arg $1 URL to run
|
||||
# @arg $2 binary to use
|
||||
run() {
|
||||
curl -fsSL $1 | $2 | indent
|
||||
}
|
||||
|
||||
# Symlink contents of source folder to target
|
||||
#
|
||||
# @arg $1 source folder
|
||||
# @arg $2 target folder
|
||||
link_folder() {
|
||||
mkdir -p $2
|
||||
cp -srf $1/. $2
|
||||
}
|
||||
|
||||
indent() { sed 's/^/ /'; }
|
||||
|
||||
# @arg $1 binary to test
|
||||
not_installed() {
|
||||
! [ -x "$(command -v $1)" ]
|
||||
}
|
||||
|
||||
# Refreshes PATH
|
||||
refresh() {
|
||||
hash -r
|
||||
}
|
||||
|
||||
# Add to PATH and refresh
|
||||
# @arg $1 path to add to PATH
|
||||
add_path() {
|
||||
export PATH="$1:$PATH"
|
||||
refresh
|
||||
}
|
||||
|
||||
export -f clean update upgrade install install_file add_ppa add_key run \
|
||||
link_folder indent not_installed refresh add_path
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Shell colours
|
||||
# ---------------------------------------------------------------------------- #
|
||||
C_BLACK='\033[0;30m'
|
||||
C_DGRAY='\033[1;30m'
|
||||
C_RED='\033[0;31m'
|
||||
C_LRED='\033[1;31m'
|
||||
C_GREEN='\033[0;32m'
|
||||
C_LGREEN='\033[1;32m'
|
||||
C_ORANGE='\033[0;33m'
|
||||
C_YELLOW='\033[1;33m'
|
||||
C_BLUE='\033[0;34m'
|
||||
C_LBLUE='\033[1;34m'
|
||||
C_PURPLE='\033[0;35m'
|
||||
C_LPURPLE='\033[1;35m'
|
||||
C_CYAN='\033[0;36m'
|
||||
C_LCYAN='\033[1;36m'
|
||||
C_LGRAY='\033[0;37m'
|
||||
C_WHITE='\033[1;37m'
|
||||
C_NC='\033[0m'
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Helper variables #
|
||||
# ---------------------------------------------------------------------------- #
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
install_dir="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
dotfiles_dir="$(dirname "$install_dir")"
|
||||
source "$dotfiles_dir/files/.bash_profile"
|
||||
refresh
|
||||
88
scripts/_utils.sh
Executable file
88
scripts/_utils.sh
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bash
|
||||
# Utility functions for common tasks
|
||||
|
||||
# @arg $1 URL to download
|
||||
# @arg $2 Path to file
|
||||
function download_file {
|
||||
curl \
|
||||
--silent \
|
||||
--show-error \
|
||||
--location \
|
||||
--output $2 \
|
||||
$1
|
||||
}
|
||||
|
||||
# @arg $1 URL to run
|
||||
# @arg $2 binary to use
|
||||
function download_run {
|
||||
file=$(mktemp)
|
||||
download_file $1 $file
|
||||
cat $file | $2
|
||||
}
|
||||
|
||||
# @arg $1 binary to test
|
||||
function bin_in_path {
|
||||
command -v $1
|
||||
}
|
||||
|
||||
# @arg $1 apt package to test
|
||||
function apt_installed {
|
||||
dpkg --status $1 >/dev/null
|
||||
}
|
||||
|
||||
function clean {
|
||||
sudo apt-get clean -qq
|
||||
}
|
||||
|
||||
function update {
|
||||
sudo apt-get update -qq
|
||||
}
|
||||
|
||||
# @arg $1 apt package to install if not present
|
||||
function install {
|
||||
if ! apt_installed $1; then
|
||||
sudo apt-get install -qq $1
|
||||
fi
|
||||
}
|
||||
|
||||
# Add apt repository
|
||||
# @arg $1 JSON object containing the following keys
|
||||
# * repository - apt repository
|
||||
# * signingKey - gpg signing key url
|
||||
# * components - apt components
|
||||
function add_repository {
|
||||
repository=$(jq -r ".repository" <<<"$1")
|
||||
if ! grep -q "^deb .*${repository}" /etc/apt/sources.list; then
|
||||
signingKey=$(jq -r ".signingKey" <<<"$1")
|
||||
components=$(jq -r ".components" <<<"$1")
|
||||
curl -fsSL $signingKey | sudo apt-key add -
|
||||
source="deb [arch=$(dpkg --print-architecture)] ${repository} ${components}"
|
||||
sudo add-apt-repository --yes "$source"
|
||||
fi
|
||||
}
|
||||
|
||||
# @arg $1 package list file to install
|
||||
function install_file {
|
||||
sudo apt-get install -qqf $(cat $1)
|
||||
}
|
||||
|
||||
# @arg $1 JSON object containing the following keys
|
||||
# * name - apt repository
|
||||
# * target - gpg signing key url
|
||||
function stow_package {
|
||||
name=$(jq -r ".name" <<<"$1")
|
||||
target=$(jq -r ".target" <<<"$1")
|
||||
|
||||
case $target in
|
||||
HOME)
|
||||
rm -f $HOME/.bashrc
|
||||
rm -f $HOME/.profile
|
||||
target=$HOME
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Stowing $ABS_DIR/files/$name to $target"
|
||||
sudo stow --dir="$ABS_DIR/files" --target=$target $name
|
||||
}
|
||||
2
scripts/install.d/00-apt-pkglist
Normal file
2
scripts/install.d/00-apt-pkglist
Normal file
@@ -0,0 +1,2 @@
|
||||
bat
|
||||
ripgrep
|
||||
2
scripts/install.d/00-apt.sh
Executable file
2
scripts/install.d/00-apt.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
cat /etc/os-release
|
||||
17
scripts/install.d/02-fish.sh
Executable file
17
scripts/install.d/02-fish.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
fish --version
|
||||
|
||||
current_shell=`grep "^$USER" /etc/passwd`
|
||||
current_shell=${current_shell##*:}
|
||||
fish_shell=`which fish`
|
||||
if [[ "$current_shell" != "$fish_shell" ]]; then
|
||||
sudo usermod --shell "$fish_shell" "$USER"
|
||||
fi
|
||||
|
||||
fisher_location="$XDG_CONFIG_HOME/fish/functions/fisher.fish"
|
||||
if ! [ -f $fisher_location ]; then
|
||||
fish -c "curl -sL https://git.io/fisher | source && fisher update"
|
||||
fi
|
||||
|
||||
fish -c "fisher update"
|
||||
fish -c "fisher --version"
|
||||
@@ -1,14 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# ssh key exists
|
||||
ssh_target="$HOME/.ssh"
|
||||
ssh_key="$ssh_target/id_rsa"
|
||||
ssh_pub="$ssh_key.pub"
|
||||
if [ ! -f "$ssh_key" ]; then
|
||||
echo "generating ssh key..."
|
||||
ssh-keygen -t rsa -b 4096 -f "$ssh_key"
|
||||
fi
|
||||
echo "ssh key exists"
|
||||
|
||||
cat "$ssh_pub"
|
||||
@@ -2,9 +2,9 @@ build-essential
|
||||
libssl-dev
|
||||
libbz2-dev
|
||||
libreadline-dev
|
||||
libreadline6
|
||||
libreadline6-dev
|
||||
libsqlite3-dev
|
||||
libxml2-dev
|
||||
libxmlsec1-dev
|
||||
llvm
|
||||
libncurses5-dev
|
||||
libncursesw5-dev
|
||||
17
scripts/install.d/10-pyenv.sh
Executable file
17
scripts/install.d/10-pyenv.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
if ! bin_in_path "pyenv"; then
|
||||
# see https://github.com/pyenv/pyenv/wiki/common-build-problems
|
||||
pyenv_list_file="$INSTALL_DIR/10-pyenv-pkglist"
|
||||
install_file "$pyenv_list_file"
|
||||
|
||||
# see https://github.com/pyenv/pyenv-installer
|
||||
download_run "https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" \
|
||||
bash
|
||||
fi
|
||||
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
|
||||
pyenv update
|
||||
|
||||
pyenv --version
|
||||
16
scripts/install.d/11-python.sh
Executable file
16
scripts/install.d/11-python.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
|
||||
if ! bin_in_path "pip3"; then
|
||||
pyenv install 3.9.0
|
||||
pyenv global 3.9.0
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
pip3 install --upgrade pip
|
||||
python3 --version
|
||||
pip3 --version
|
||||
|
||||
for dep in `jq -r ".pip_dependencies[]" $CONFIG`; do
|
||||
pip3 install --upgrade $dep
|
||||
done
|
||||
15
scripts/install.d/13-nvm.sh
Executable file
15
scripts/install.d/13-nvm.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
nvm_version="v0.38.0"
|
||||
if ! bin_in_path "nvm"; then
|
||||
download_run "https://raw.githubusercontent.com/nvm-sh/nvm/${nvm_version}/install.sh" \
|
||||
"bash"
|
||||
fi
|
||||
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
||||
nvm --version
|
||||
nvm alias default lts/fermium
|
||||
nvm install lts/fermium
|
||||
nvm use lts/fermium
|
||||
|
||||
node --version
|
||||
7
scripts/install.d/14-yarn.sh
Executable file
7
scripts/install.d/14-yarn.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
yarn --version
|
||||
|
||||
for dep in `jq -r ".node_dependencies[]" $CONFIG`; do
|
||||
yarn global add $dep
|
||||
yarn global upgrade $dep
|
||||
done
|
||||
27
scripts/install.d/16-vim.sh
Executable file
27
scripts/install.d/16-vim.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Install neovim from unstable debian repo
|
||||
if ! bin_in_path "nvim"; then
|
||||
curl -fsSL "https://ftp-master.debian.org/keys/archive-key-10.asc" | sudo apt-key add -
|
||||
echo "deb http://deb.debian.org/debian unstable main" \
|
||||
| sudo tee /etc/apt/sources.list.d/unstable.list
|
||||
echo "Package: neovim
|
||||
Pin: release a=unstable
|
||||
Pin-Priority: 900" \
|
||||
| sudo tee /etc/apt/preferences.d/neovim
|
||||
update
|
||||
install neovim
|
||||
fi
|
||||
|
||||
mkdir -p "$XDG_DATA_HOME/nvim/backup"
|
||||
plug_dir="$XDG_DATA_HOME/nvim/site/autoload"
|
||||
mkdir -p "$plug_dir"
|
||||
plug_target="$plug_dir/plug.vim"
|
||||
if [ ! -f $plug_target ]; then
|
||||
download_file \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim \
|
||||
"$plug_target"
|
||||
fi
|
||||
|
||||
nvim --headless +UpdateRemotePlugins +PlugClean! +PlugInstall +PlugUpgrade +PlugUpdate +qall
|
||||
nvim --version
|
||||
5
scripts/install.d/17-emacs.sh
Normal file
5
scripts/install.d/17-emacs.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
if [ ! -d ~/.emacs.d ]; then
|
||||
echo "Cloning spacemacs"
|
||||
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
|
||||
fi
|
||||
13
scripts/install.d/30-docker.sh
Executable file
13
scripts/install.d/30-docker.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
docker --version
|
||||
|
||||
readonly docker_group="docker"
|
||||
if ! grep -q "$docker_group" /etc/group; then
|
||||
echo "Adding docker group"
|
||||
sudo groupadd "$docker_group"
|
||||
fi
|
||||
|
||||
if ! groups "$USER" | grep -q "\b$docker_group\b"; then
|
||||
echo "Adding user to docker group"
|
||||
sudo usermod -aG docker "$USER"
|
||||
fi
|
||||
2
scripts/install.d/98-apt-clean.sh
Executable file
2
scripts/install.d/98-apt-clean.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
clean
|
||||
2
scripts/install.d/99-screenfetch.sh
Executable file
2
scripts/install.d/99-screenfetch.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
screenfetch
|
||||
72
scripts/install.sh
Executable file
72
scripts/install.sh
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
#
|
||||
# Script that installs system dependencies specified in a config,
|
||||
# and runs all post-install scripts contained in a subdirectory.
|
||||
#
|
||||
|
||||
TIME=${TIME:-$(date)}
|
||||
UUID=${UUID:-$(uuidgen)}
|
||||
HOST=${HOST:-$(hostname)}
|
||||
|
||||
NAME=$(basename "$0")
|
||||
REL_DIR=$(dirname "$0")
|
||||
ABS_DIR=$(readlink -f $REL_DIR/../) # Scripts are nested inside of /scripts
|
||||
|
||||
UTILS="${REL_DIR}/_utils.sh"
|
||||
CONFIG="${REL_DIR}/install_config.json"
|
||||
INSTALL_DIR="${REL_DIR}/install.d"
|
||||
|
||||
LOG_DIR="${ABS_DIR}/logs"
|
||||
mkdir -p "$LOG_DIR"
|
||||
LOG_TARGET=${LOG_TARGET:-"${LOG_DIR}/${UUID}.log"}
|
||||
|
||||
install() {
|
||||
echo "Running $NAME at $TIME"
|
||||
echo "Running as $USER on $HOST"
|
||||
|
||||
# Prevent running as root
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
echo "Failed: Running as sudo. Please run as user"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load installer dependencies
|
||||
source "$UTILS"
|
||||
update
|
||||
install jq
|
||||
for dep in $(jq -r ".apt_core_dependencies[]" "$CONFIG"); do
|
||||
install "$dep"
|
||||
done
|
||||
|
||||
# Add apt repositories
|
||||
for i in $(jq ".apt_repositories | keys | .[]" "$CONFIG"); do
|
||||
value=$(jq -r ".apt_repositories[$i]" "$CONFIG")
|
||||
add_repository "$value"
|
||||
done
|
||||
update
|
||||
|
||||
# Install apt dependencies
|
||||
for dep in $(jq -r ".apt_dependencies[]" "$CONFIG"); do
|
||||
install "$dep"
|
||||
done
|
||||
|
||||
# Install dotfiles on system and load them
|
||||
figlet -c "Stowing..."
|
||||
for i in $(jq ".stow_packages | keys | .[]" "$CONFIG"); do
|
||||
value=$(jq -r ".stow_packages[$i]" "$CONFIG")
|
||||
stow_package "$value"
|
||||
done
|
||||
source "$HOME/.profile"
|
||||
|
||||
# Run custom installer scripts
|
||||
figlet -c "Installing..."
|
||||
for script in $INSTALL_DIR/*.sh; do
|
||||
figlet -c "$(basename $script)"
|
||||
source $script
|
||||
done
|
||||
}
|
||||
|
||||
echo "install: Logging to $LOG_TARGET"
|
||||
install 2>&1 | tee "$LOG_TARGET"
|
||||
91
scripts/install_config.json
Normal file
91
scripts/install_config.json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"apt_repositories": [
|
||||
{
|
||||
"signingKey": "https://apt.releases.hashicorp.com/gpg",
|
||||
"repository": "https://apt.releases.hashicorp.com",
|
||||
"components": "buster main"
|
||||
},
|
||||
{
|
||||
"signingKey": "https://dl.yarnpkg.com/debian/pubkey.gpg",
|
||||
"repository": "https://dl.yarnpkg.com/debian",
|
||||
"components": "stable main"
|
||||
},
|
||||
{
|
||||
"signingKey": "https://packages.cloud.google.com/apt/doc/apt-key.gpg",
|
||||
"repository": "https://packages.cloud.google.com/apt",
|
||||
"components": "cloud-sdk main"
|
||||
},
|
||||
{
|
||||
"signingKey": "https://packages.cloud.google.com/apt/doc/apt-key.gpg",
|
||||
"repository": "https://apt.kubernetes.io/",
|
||||
"components": "kubernetes-xenial main"
|
||||
},
|
||||
{
|
||||
"signingKey": "https://download.docker.com/linux/debian/gpg",
|
||||
"repository": "https://download.docker.com/linux/debian",
|
||||
"components": "buster stable"
|
||||
},
|
||||
{
|
||||
"signingKey": "https://download.opensuse.org/repositories/shells:fish/Debian_10/Release.key",
|
||||
"repository": "https://download.opensuse.org/repositories/shells:/fish/Debian_10/",
|
||||
"components": "/"
|
||||
}
|
||||
],
|
||||
"apt_core_dependencies": [
|
||||
"curl",
|
||||
"gnupg",
|
||||
"gnupg2"
|
||||
],
|
||||
"apt_dependencies": [
|
||||
"apt-transport-https",
|
||||
"ca-certificates",
|
||||
"containerd.io",
|
||||
"cowsay",
|
||||
"default-jre",
|
||||
"devscripts",
|
||||
"docker-ce",
|
||||
"docker-ce-cli",
|
||||
"emacs",
|
||||
"fd-find",
|
||||
"figlet",
|
||||
"fish",
|
||||
"fonts-nanum",
|
||||
"fortune-mod",
|
||||
"fzf",
|
||||
"google-cloud-sdk",
|
||||
"git",
|
||||
"kubectl",
|
||||
"lsb-release",
|
||||
"make",
|
||||
"net-tools",
|
||||
"openssh-client",
|
||||
"openssh-server",
|
||||
"screenfetch",
|
||||
"stow",
|
||||
"terraform",
|
||||
"terraform-ls",
|
||||
"tmux",
|
||||
"unzip",
|
||||
"yarn"
|
||||
],
|
||||
"node_dependencies": [
|
||||
"firebase-tools",
|
||||
"neovim",
|
||||
"typescript",
|
||||
"typescript-language-server"
|
||||
],
|
||||
"pip_dependencies": [
|
||||
"awscli",
|
||||
"docker-compose",
|
||||
"neovim",
|
||||
"poetry",
|
||||
"python-language-server[all]",
|
||||
"pyvim"
|
||||
],
|
||||
"stow_packages": [
|
||||
{
|
||||
"name": "home",
|
||||
"target": "HOME"
|
||||
}
|
||||
]
|
||||
}
|
||||
11
scripts/publish.sh
Executable file
11
scripts/publish.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
BUCKET=${BUCKET:-"dots.andrejus.dev"}
|
||||
|
||||
NAME=$(basename "$0")
|
||||
REL_DIR=$(dirname "$0")
|
||||
ABS_DIR=$(readlink -f $REL_DIR/../) # Scripts are nested inside of /scripts
|
||||
|
||||
# Publish setup script to public bucket
|
||||
gsutil cp "$ABS_DIR/scripts/setup.sh" "gs://$BUCKET/setup.sh"
|
||||
13
scripts/run.sh
Executable file
13
scripts/run.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
tag=$(uuidgen)
|
||||
docker build . \
|
||||
--build-arg UUID=$tag \
|
||||
--tag dotfiles:$tag \
|
||||
--target install
|
||||
|
||||
docker run \
|
||||
-v "$(pwd)"/logs:/home/test-user/.dotfiles/logs \
|
||||
dotfiles:$tag
|
||||
/bin/bash
|
||||
34
scripts/setup.sh
Executable file
34
scripts/setup.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
#
|
||||
# Script that checks out a compatible dotfiles repository
|
||||
# and runs the installer to set up a new installation.
|
||||
#
|
||||
|
||||
author=${GITHUB_AUTHOR:-andrejusk}
|
||||
repository=${GITHUB_REPOSITORY:-dotfiles}
|
||||
branch=${GITHUB_BRANCH:-master}
|
||||
echo "Using repository $author/$repository at $branch"
|
||||
|
||||
setup_dir=${DOTFILES_DIR:-$HOME/.dotfiles}
|
||||
|
||||
# Prevent overwriting existing installation
|
||||
mkdir -p $setup_dir
|
||||
if [[ -z $(ls -A $setup_dir) ]]; then
|
||||
echo "Setting up $setup_dir"
|
||||
else
|
||||
echo "Failed: Setup directory not empty $setup_dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Download and untar repo
|
||||
tmp_dir=`mktemp -d`
|
||||
tmp_dest="$tmp_dir/dotfiles.tar.gz"
|
||||
wget "https://github.com/$author/$repository/archive/$branch.tar.gz" -qO $tmp_dest
|
||||
tar -C $tmp_dir -zxf $tmp_dest
|
||||
mv $tmp_dir/$repository-$branch/* $setup_dir
|
||||
rm -rf $tmp_dir
|
||||
|
||||
echo "Done!"
|
||||
$setup_dir/scripts/install.sh
|
||||
12
scripts/test.sh
Executable file
12
scripts/test.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
tag=$(uuidgen)
|
||||
docker build . \
|
||||
--build-arg UUID=$tag \
|
||||
--tag dotfiles:$tag \
|
||||
--target test
|
||||
|
||||
docker run \
|
||||
-v "$(pwd)"/logs:/home/test-user/.dotfiles/logs \
|
||||
dotfiles:$tag
|
||||
46
setup.pl
46
setup.pl
@@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
use Archive::Tar;
|
||||
use File::Copy;
|
||||
use File::Temp ();
|
||||
use IPC::System::Simple qw(capture);
|
||||
use LWP::Simple;
|
||||
|
||||
|
||||
print "Setting up...\n";
|
||||
|
||||
# GitHub repository to clone
|
||||
my $author = $ENV{'DOTFILES_AUTHOR'} // 'andrejusk';
|
||||
my $repository = $ENV{'DOTFILES_REPOSITORY'} // 'dotfiles';
|
||||
my $branch = $ENV{'DOTFILES_BRANCH'} // 'master';
|
||||
print "Using repository $author/$repository at $branch\n";
|
||||
|
||||
# Install location
|
||||
my $dotfiles_dir = $ENV{'DOTFILES_DIR'} // "$ENV{'HOME'}/.dotfiles";
|
||||
|
||||
# Download repo
|
||||
my $repository_url = "https://github.com/$author/$repository/archive/$branch.tar.gz";
|
||||
my $temp_handle = File::Temp->new();
|
||||
my $repository_temp = $temp_handle->filename;
|
||||
print "Downloading $repository_url to $repository_temp\n";
|
||||
getstore($repository_url, $repository_temp);
|
||||
|
||||
# Extract repo
|
||||
my $temp_dir = File::Temp->newdir();
|
||||
my $tar = Archive::Tar->new;
|
||||
print "Extracting $repository_temp to $temp_dir\n";
|
||||
$tar->read($repository_temp);
|
||||
$tar->setcwd($temp_dir);
|
||||
$tar->extract();
|
||||
|
||||
# Move dotfiles out of temporary dir
|
||||
my $temp_dotfiles_dir = "$temp_dir/$repository-$branch";
|
||||
print "Moving $temp_dotfiles_dir to $dotfiles_dir\n";
|
||||
move($temp_dotfiles_dir, $dotfiles_dir);
|
||||
|
||||
# Install repo
|
||||
print "Running installer\n";
|
||||
`$dotfiles_dir/install.pl`;
|
||||
129
terraform/module/main.tf
Normal file
129
terraform/module/main.tf
Normal file
@@ -0,0 +1,129 @@
|
||||
locals {
|
||||
fqdn = "${var.domain}."
|
||||
}
|
||||
|
||||
# =================================================================
|
||||
# Public bucket for static content with uploader service account
|
||||
# =================================================================
|
||||
resource "google_project_service" "storage" {
|
||||
service = "storage.googleapis.com"
|
||||
}
|
||||
|
||||
resource "google_service_account" "uploader_sa" {
|
||||
account_id = "${var.prefix}-uploader-sa"
|
||||
display_name = "Uploader Service Account"
|
||||
}
|
||||
|
||||
resource "google_storage_bucket" "bucket" {
|
||||
name = var.domain
|
||||
depends_on = [google_project_service.storage]
|
||||
|
||||
location = var.gcs_location
|
||||
website {
|
||||
main_page_suffix = "index.html"
|
||||
not_found_page = "index.html"
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_storage_bucket_acl" "bucket_acl" {
|
||||
bucket = google_storage_bucket.bucket.name
|
||||
|
||||
role_entity = [
|
||||
"READER:allUsers",
|
||||
"OWNER:user-${google_service_account.uploader_sa.email}",
|
||||
]
|
||||
}
|
||||
|
||||
resource "google_storage_bucket_object" "index" {
|
||||
name = "index.html"
|
||||
source = "${path.module}/public/index.html"
|
||||
bucket = google_storage_bucket.bucket.name
|
||||
}
|
||||
|
||||
# =================================================================
|
||||
# Expose bucket via HTTPS using Cloud CDN
|
||||
#
|
||||
# Adapted from
|
||||
# https://medium.com/cognite/configuring-google-cloud-cdn-with-terraform-ab65bb0456a9
|
||||
# =================================================================
|
||||
resource "google_project_service" "compute" {
|
||||
service = "compute.googleapis.com"
|
||||
}
|
||||
|
||||
resource "google_compute_backend_bucket" "backend" {
|
||||
name = "${var.prefix}-backend"
|
||||
depends_on = [google_project_service.compute]
|
||||
|
||||
bucket_name = google_storage_bucket.bucket.name
|
||||
description = "Bucket backend for serving static content through CDN"
|
||||
enable_cdn = true
|
||||
}
|
||||
|
||||
resource "google_compute_url_map" "urlmap" {
|
||||
name = "${var.prefix}-urlmap"
|
||||
description = "URL map to bucket backend service"
|
||||
default_service = google_compute_backend_bucket.backend.self_link
|
||||
}
|
||||
|
||||
resource "google_compute_managed_ssl_certificate" "certificate" {
|
||||
name = "${var.prefix}-certificate"
|
||||
depends_on = [google_project_service.compute]
|
||||
|
||||
managed {
|
||||
domains = [local.fqdn]
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_compute_target_https_proxy" "https" {
|
||||
name = "${var.prefix}-https-proxy"
|
||||
url_map = google_compute_url_map.urlmap.self_link
|
||||
ssl_certificates = [google_compute_managed_ssl_certificate.certificate.self_link]
|
||||
}
|
||||
|
||||
resource "google_compute_global_address" "ipv4" {
|
||||
name = "${var.prefix}-ipv4"
|
||||
depends_on = [google_project_service.compute]
|
||||
|
||||
ip_version = "IPV4"
|
||||
address_type = "EXTERNAL"
|
||||
}
|
||||
|
||||
resource "google_compute_global_address" "ipv6" {
|
||||
name = "${var.prefix}-ipv6"
|
||||
depends_on = [google_project_service.compute]
|
||||
|
||||
ip_version = "IPV6"
|
||||
address_type = "EXTERNAL"
|
||||
}
|
||||
|
||||
resource "google_compute_global_forwarding_rule" "fwd_ipv4" {
|
||||
name = "${var.prefix}-fwd-ipv4"
|
||||
target = google_compute_target_https_proxy.https.self_link
|
||||
ip_address = google_compute_global_address.ipv4.address
|
||||
port_range = "443"
|
||||
}
|
||||
|
||||
resource "google_compute_global_forwarding_rule" "fwd_ipv6" {
|
||||
name = "${var.prefix}-fwd-ipv6"
|
||||
target = google_compute_target_https_proxy.https.self_link
|
||||
ip_address = google_compute_global_address.ipv6.address
|
||||
port_range = "443"
|
||||
}
|
||||
|
||||
resource "google_dns_record_set" "dns_a_record" {
|
||||
name = local.fqdn
|
||||
managed_zone = var.dns_zone
|
||||
|
||||
type = "A"
|
||||
ttl = var.dns_ttl
|
||||
rrdatas = [google_compute_global_address.ipv4.address]
|
||||
}
|
||||
|
||||
resource "google_dns_record_set" "dns_aaaa_record" {
|
||||
name = local.fqdn
|
||||
managed_zone = var.dns_zone
|
||||
|
||||
type = "AAAA"
|
||||
ttl = var.dns_ttl
|
||||
rrdatas = [google_compute_global_address.ipv6.address]
|
||||
}
|
||||
7
terraform/module/outputs.tf
Normal file
7
terraform/module/outputs.tf
Normal file
@@ -0,0 +1,7 @@
|
||||
output "bucket_url" {
|
||||
value = "storage.googleapis.com/${var.domain}"
|
||||
}
|
||||
|
||||
output "bucket_link" {
|
||||
value = google_storage_bucket.bucket.self_link
|
||||
}
|
||||
24
terraform/module/public/index.html
Normal file
24
terraform/module/public/index.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>andrejus.dev</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="referrer" content="no-referrer" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width,minimum-scale=1,initial-scale=1"
|
||||
/>
|
||||
|
||||
<link rel="canonical" href="https://andrejus.dev/" />
|
||||
<meta
|
||||
http-equiv="refresh"
|
||||
content="0; url=https://github.com/andrejusk/dotfiles"
|
||||
/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<p>Redirecting to GitHub repo...</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
31
terraform/module/variables.tf
Normal file
31
terraform/module/variables.tf
Normal file
@@ -0,0 +1,31 @@
|
||||
variable "prefix" {
|
||||
description = "Resource prefix"
|
||||
default = "dots"
|
||||
}
|
||||
|
||||
variable "project" {
|
||||
description = "Google Cloud project to host resources in"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "domain" {
|
||||
description = "DNS name to serve static content"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "dns_zone" {
|
||||
description = "Cloud DNS zone to use"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "gcs_location" {
|
||||
type = string
|
||||
description = "Google Stoage location to provision resources in"
|
||||
default = "EU" # Multi-region, Europe
|
||||
}
|
||||
|
||||
variable "dns_ttl" {
|
||||
type = number
|
||||
description = "DNS TTL to use for records"
|
||||
default = 3600
|
||||
}
|
||||
3
tests/.gitignore
vendored
Normal file
3
tests/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# pytest
|
||||
**/__pycache__
|
||||
**/.pytest_cache
|
||||
@@ -1 +1 @@
|
||||
3.7.0
|
||||
3.9.0
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
SHELL := /bin/bash
|
||||
all:
|
||||
poetry install
|
||||
poetry run pytest
|
||||
136
tests/poetry.lock
generated
136
tests/poetry.lock
generated
@@ -1,19 +1,18 @@
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Atomic file writes."
|
||||
marker = "sys_platform == \"win32\""
|
||||
name = "atomicwrites"
|
||||
version = "1.3.0"
|
||||
description = "Atomic file writes."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "1.3.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Classes Without Boilerplate"
|
||||
name = "attrs"
|
||||
version = "19.3.0"
|
||||
description = "Classes Without Boilerplate"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "19.3.0"
|
||||
|
||||
[package.extras]
|
||||
azure-pipelines = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "pytest-azurepipelines"]
|
||||
@@ -22,22 +21,20 @@ docs = ["sphinx", "zope.interface"]
|
||||
tests = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"]
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Cross-platform colored terminal text."
|
||||
marker = "sys_platform == \"win32\""
|
||||
name = "colorama"
|
||||
version = "0.4.3"
|
||||
description = "Cross-platform colored terminal text."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
version = "0.4.3"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Read metadata from Python packages"
|
||||
marker = "python_version < \"3.8\""
|
||||
name = "importlib-metadata"
|
||||
version = "1.5.0"
|
||||
description = "Read metadata from Python packages"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
|
||||
version = "1.5.0"
|
||||
|
||||
[package.dependencies]
|
||||
zipp = ">=0.5"
|
||||
@@ -47,115 +44,130 @@ docs = ["sphinx", "rst.linker"]
|
||||
testing = ["packaging", "importlib-resources"]
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "More routines for operating on iterables, beyond itertools"
|
||||
name = "more-itertools"
|
||||
version = "8.2.0"
|
||||
description = "More routines for operating on iterables, beyond itertools"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
version = "8.2.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Core utilities for Python packages"
|
||||
name = "packaging"
|
||||
version = "20.1"
|
||||
description = "Core utilities for Python packages"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "20.1"
|
||||
|
||||
[package.dependencies]
|
||||
pyparsing = ">=2.0.2"
|
||||
six = "*"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "plugin and hook calling mechanisms for python"
|
||||
name = "pluggy"
|
||||
version = "0.13.1"
|
||||
description = "plugin and hook calling mechanisms for python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "0.13.1"
|
||||
|
||||
[package.dependencies]
|
||||
[package.dependencies.importlib-metadata]
|
||||
python = "<3.8"
|
||||
version = ">=0.12"
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
|
||||
[package.extras]
|
||||
dev = ["pre-commit", "tox"]
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
||||
name = "py"
|
||||
version = "1.8.1"
|
||||
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "1.8.1"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Python parsing module"
|
||||
name = "pyparsing"
|
||||
version = "2.4.6"
|
||||
description = "Python parsing module"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
version = "2.4.6"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "pytest: simple powerful testing with Python"
|
||||
name = "pytest"
|
||||
version = "5.3.5"
|
||||
description = "pytest: simple powerful testing with Python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
version = "5.3.5"
|
||||
|
||||
[package.dependencies]
|
||||
atomicwrites = ">=1.0"
|
||||
atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""}
|
||||
attrs = ">=17.4.0"
|
||||
colorama = "*"
|
||||
colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
more-itertools = ">=4.0.0"
|
||||
packaging = "*"
|
||||
pluggy = ">=0.12,<1.0"
|
||||
py = ">=1.5.0"
|
||||
wcwidth = "*"
|
||||
|
||||
[package.dependencies.importlib-metadata]
|
||||
python = "<3.8"
|
||||
version = ">=0.12"
|
||||
|
||||
[package.extras]
|
||||
checkqa-mypy = ["mypy (v0.761)"]
|
||||
checkqa-mypy = ["mypy (==v0.761)"]
|
||||
testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-parallel"
|
||||
version = "0.1.0"
|
||||
description = "a pytest plugin for parallel and concurrent testing"
|
||||
category = "dev"
|
||||
description = "Python 2 and 3 compatibility utilities"
|
||||
name = "six"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
version = "1.14.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Measures number of Terminal column cells of wide-character codes"
|
||||
name = "wcwidth"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "0.1.8"
|
||||
|
||||
[package.dependencies]
|
||||
pytest = ">=3.0.0"
|
||||
tblib = "*"
|
||||
|
||||
[[package]]
|
||||
name = "six"
|
||||
version = "1.14.0"
|
||||
description = "Python 2 and 3 compatibility utilities"
|
||||
category = "dev"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
marker = "python_version < \"3.8\""
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
|
||||
[[package]]
|
||||
name = "tblib"
|
||||
version = "1.7.0"
|
||||
description = "Traceback serialization library."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[[package]]
|
||||
name = "wcwidth"
|
||||
version = "0.1.8"
|
||||
description = "Measures number of Terminal column cells of wide-character codes"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "zipp"
|
||||
version = "3.0.0"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
version = "3.0.0"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]
|
||||
testing = ["jaraco.itertools", "func-timeout"]
|
||||
|
||||
[metadata]
|
||||
content-hash = "76f248e0ec62688089444c71c5e62af7c3ca83978a893d09e6592e3621985fab"
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.7"
|
||||
content-hash = "74334db56ae752441434e742efb55e7b5499d3757b7ba674261897cb0b77c741"
|
||||
|
||||
[metadata.files]
|
||||
atomicwrites = [
|
||||
@@ -198,10 +210,18 @@ pytest = [
|
||||
{file = "pytest-5.3.5-py3-none-any.whl", hash = "sha256:ff615c761e25eb25df19edddc0b970302d2a9091fbce0e7213298d85fb61fef6"},
|
||||
{file = "pytest-5.3.5.tar.gz", hash = "sha256:0d5fe9189a148acc3c3eb2ac8e1ac0742cb7618c084f3d228baaec0c254b318d"},
|
||||
]
|
||||
pytest-parallel = [
|
||||
{file = "pytest-parallel-0.1.0.tar.gz", hash = "sha256:4663a8fb805ac98b51e51de84d35ffd9717017fb71ed270440dc94b862466c20"},
|
||||
{file = "pytest_parallel-0.1.0-py3-none-any.whl", hash = "sha256:10693161e350b59466ca331bad964073555cda114cc0499bd826deeceee512ed"},
|
||||
]
|
||||
six = [
|
||||
{file = "six-1.14.0-py2.py3-none-any.whl", hash = "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c"},
|
||||
{file = "six-1.14.0.tar.gz", hash = "sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a"},
|
||||
]
|
||||
tblib = [
|
||||
{file = "tblib-1.7.0-py2.py3-none-any.whl", hash = "sha256:289fa7359e580950e7d9743eab36b0691f0310fce64dee7d9c31065b8f723e23"},
|
||||
{file = "tblib-1.7.0.tar.gz", hash = "sha256:059bd77306ea7b419d4f76016aef6d7027cc8a0785579b5aad198803435f882c"},
|
||||
]
|
||||
wcwidth = [
|
||||
{file = "wcwidth-0.1.8-py2.py3-none-any.whl", hash = "sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603"},
|
||||
{file = "wcwidth-0.1.8.tar.gz", hash = "sha256:f28b3e8a6483e5d49e7f8949ac1a78314e740333ae305b4ba5defd3e74fb37a8"},
|
||||
|
||||
@@ -9,6 +9,7 @@ python = "^3.7"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
pytest = "^5.3.5"
|
||||
pytest-parallel = "^0.1.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
|
||||
4
tests/run.sh
Executable file
4
tests/run.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
bash -l -c "poetry install && poetry run pytest"
|
||||
@@ -67,7 +67,6 @@ binaries: List[str] = [
|
||||
"node",
|
||||
"npm",
|
||||
"yarn",
|
||||
# "elm",
|
||||
|
||||
# language: java
|
||||
"java",
|
||||
|
||||
Reference in New Issue
Block a user