diff --git a/.drone.yml b/.drone.yml index 33e8247..09709d2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,12 +4,16 @@ name: default steps: - name: docker image: plugins/docker - build_args: - - UBUNTU_MIRROR=http://de.archive.ubuntu.com/ubuntu settings: repo: sneak/work - dry_run: true - #auto_tag: true + #dry_run: true + build_args: + - UBUNTU_MIRROR=http://de.archive.ubuntu.com/ubuntu + username: + from_secret: docker_username + password: + from_secret: docker_password tags: + - ${DRONE_BRANCH//\//-}-${DRONE_COMMIT_SHA:0:8} - ${DRONE_COMMIT_SHA} - - ${DRONE_BRANCH} + - ${DRONE_BRANCH/\//-} diff --git a/Dockerfile b/Dockerfile index 7390394..d8d5d28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,25 @@ -FROM ubuntu@sha256:8e1c1ee12a539d652c371ee2f4ee66909f4f5fd8002936d8011d958f05faf989 +FROM sneak/workbase -ENV DEBIAN_FRONTEND noninteractive +# nix for pkgs pls +RUN mkdir /nix && chown user:user /nix -ARG UBUNTU_MIRROR=http://us.archive.ubuntu.com/ubuntu - -ARG UID_TO_ADD=1000 -ARG GID_TO_ADD=1000 -ARG USERNAME_TO_ADD=sneak - -RUN \ - echo "deb $UBUNTU_MIRROR focal main universe restricted multiverse" > /etc/apt/sources.list.new && \ - echo "deb $UBUNTU_MIRROR focal-updates main universe restricted multiverse" >> /etc/apt/sources.list.new && \ - echo "deb $UBUNTU_MIRROR focal-security main universe restricted multiverse" >> /etc/apt/sources.list.new && \ - echo "deb $UBUNTU_MIRROR focal-backports main universe restricted multiverse" >> /etc/apt/sources.list.new && \ - mv /etc/apt/sources.list.new /etc/apt/sources.list - -ADD https://sneak.cloud/authorized_keys /root/.ssh/authorized_keys - -# we only install essential system packages here -ARG SYSTEM_PACKAGES="build-essential ca-certificates openssh-server git golang rsync runit locales" - -RUN \ - apt update && \ - apt -y upgrade && \ - apt -y install $SYSTEM_PACKAGES && \ - groupadd -g $GID_TO_ADD $USERNAME_TO_ADD && \ - useradd -u $UID_TO_ADD -g $GID_TO_ADD -s /bin/bash $USERNAME_TO_ADD && \ - usermod -p '*' $USERNAME_TO_ADD && \ - go get -v -u github.com/peterbourgon/runsvinit && \ - cp /root/go/bin/runsvinit /usr/local/sbin/runsvinit && \ - rm -rf /root/go && \ - rm /etc/ssh/*host*key* - -COPY ./setup /tmp/setup -RUN bash /tmp/setup/run.sh +USER root +ENV HOME /root COPY ./root / +COPY ./root.sh /tmp/build/root.sh +COPY ./user.sh /tmp/build/user.sh +RUN bash /tmp/build/root.sh + +USER user +ENV HOME /home/user +RUN bash /tmp/build/user.sh + +USER root +ENV HOME /root +RUN rm -rf /tmp/build + +RUN chsh --shell /home/user/.nix-profile/bin/zsh user RUN chmod +rx /etc/service/*/run - CMD ["/usr/local/sbin/runsvinit"] diff --git a/Makefile b/Makefile index cb78d6a..b7da150 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,32 @@ +export DOCKER_HOST := ssh://root@meatfucker.local + default: build +.PHONY: build run base full release + +start: + make build + make run + build: - sudo docker build . 2>&1 | tee -a build.log + docker build --squash -t sneak/work . + +full: + cd base && make build + make build + +run: + -docker rm -f work + docker run \ + -d \ + --name work \ + --hostname work \ + --net host \ + -v /:/hostroot \ + -v /home/sneak:/hosthome \ + -v /var/run/docker.sock:/var/run/docker.sock \ + sneak/work + +release: + make full && make run + diff --git a/README.md b/README.md index 8f499c5..3d97d9e 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,13 @@ sneak's working environment +# todo + +* zsh configuration +* powerline setup +* test vimrc +* ssh-agent setup inside container from zshrc + # license wtfpl diff --git a/base/Dockerfile b/base/Dockerfile new file mode 100644 index 0000000..7c0e569 --- /dev/null +++ b/base/Dockerfile @@ -0,0 +1,63 @@ +#FROM ubuntu:focal-20201008 +FROM ubuntu@sha256:1d7b639619bdca2d008eca2d5293e3c43ff84cbee597ff76de3b7a7de3e84956 + +ENV DEBIAN_FRONTEND noninteractive + +ARG UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt + +ARG UID_TO_ADD=1000 +ARG GID_TO_ADD=1000 +ARG USERNAME_TO_ADD=user + +RUN apt update && apt install -y ca-certificates apt-transport-https +#RUN \ +# echo "deb $UBUNTU_MIRROR focal main universe restricted multiverse" > /etc/apt/sources.list.new && \ +# echo "deb $UBUNTU_MIRROR focal-updates main universe restricted multiverse" >> /etc/apt/sources.list.new && \ +# echo "deb $UBUNTU_MIRROR focal-security main universe restricted multiverse" >> /etc/apt/sources.list.new && \ +# echo "deb $UBUNTU_MIRROR focal-backports main universe restricted multiverse" >> /etc/apt/sources.list.new && \ +# mv /etc/apt/sources.list.new /etc/apt/sources.list + +RUN \ + groupadd -g $GID_TO_ADD $USERNAME_TO_ADD && \ + groupadd nixbld && \ + useradd -u $UID_TO_ADD -g $GID_TO_ADD --home-dir /home/user -m -s /bin/bash $USERNAME_TO_ADD && \ + usermod -p '*' $USERNAME_TO_ADD + +ADD https://sneak.cloud/authorized_keys /root/.ssh/authorized_keys +ADD https://sneak.cloud/authorized_keys /home/user/.ssh/authorized_keys + +RUN apt update && apt install -y \ + anacron \ + apt-transport-https \ + avahi-daemon \ + build-essential \ + byobu \ + ca-certificates \ + cron \ + cronic \ + curl \ + git \ + golang \ + iproute2 \ + iputils-ping \ + locales \ + openssh-server \ + rsync \ + runit \ + sudo \ + vim \ + zsh + +RUN /bin/bash -c "echo -e 'Y\n\n' | /usr/local/sbin/unminimize" + +RUN \ + go get -v -u github.com/peterbourgon/runsvinit && \ + cp /root/go/bin/runsvinit /usr/local/sbin/runsvinit && \ + rm -rf /root/go && \ + apt -y purge golang && \ + apt -y upgrade && \ + apt -y autoremove + +RUN usermod --shell $(which zsh) $USERNAME_TO_ADD + +CMD ["/usr/local/sbin/runsvinit"] diff --git a/base/Makefile b/base/Makefile new file mode 100644 index 0000000..642b20e --- /dev/null +++ b/base/Makefile @@ -0,0 +1,6 @@ +default: build + +.PHONY: build + +build: + docker build --squash -t sneak/workbase . diff --git a/bin/start b/bin/start deleted file mode 100755 index d21af5d..0000000 --- a/bin/start +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -pushd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)/../" -docker build -t sneak/work . -popd - - -# FIXME ssh host keys -docker run \ - -d \ - --name work \ - -v /:/hostroot \ - -v /home/sneak/.ssh/id_rsa:/home/sneak/.ssh/id_rsa \ - -v /home/sneak/.ssh/config:/home/sneak/.ssh/config \ - -v /home/sneak/.ssh/known_hosts:/home/sneak/.ssh/known_hosts \ - -v /home/sneak/Documents:/home/sneak/Documents \ - -v /var/run/docker.sock:/var/run/docker.sock \ - sneak/work diff --git a/root.sh b/root.sh new file mode 100644 index 0000000..e83f24c --- /dev/null +++ b/root.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +echo "##### build/root.sh" + +export LANG="en_US.UTF-8" +export LANGUAGE="en_US:en" + +set -x +set -e + +TD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +cd "$TD" + +SSH_HOST_KEY_FILES=" + ssh_host_ecdsa_key + ssh_host_ecdsa_key.pub + ssh_host_ed25519_key + ssh_host_ed25519_key.pub + ssh_host_rsa_key + ssh_host_rsa_key.pub +" +echo "en_US.UTF-8 UTF-8" > /etc/locale.gen +locale-gen en_US.UTF-8 +update-locale LANG="en_US.UTF-8" LANGUAGE="en_US" +dpkg-reconfigure locales + +for FN in $SSH_HOST_KEY_FILES ; do + rm -f /etc/ssh/$FN + ln -s /hostroot/etc/ssh/$FN /etc/ssh/$FN +done + +#ln -s /hostroot/root /root/.home + +# install other stuff here + +# FIXME do these with nix: +#pip3 install -U pip +#pip3 install black + +# install python packages +# install yarn +# install prettier +# install vim-go + + +# i don't know how to make the terraform-libvirt provider +# build with nix's libvirt, this works for now +apt update && apt install -y libvirt0 + +mkdir -p /home/user/.ssh +cp /root/.ssh/authorized_keys /home/user/.ssh/authorized_keys +chown -R user:user /home/user +echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/user + +groupadd -g 131 docker +usermod -aG docker user + +#mkdir -p /etc/nix +#echo 'sandbox = false' > /etc/nix/nix.conf +#chown -R user:user /nix /etc/nix diff --git a/root/etc/service/sshd/run b/root/etc/service/sshd/run new file mode 100644 index 0000000..1f479ce --- /dev/null +++ b/root/etc/service/sshd/run @@ -0,0 +1,4 @@ +#!/bin/bash + +mkdir -p /run/sshd +exec /usr/sbin/sshd -D diff --git a/root/etc/ssh/sshd_config.d/port.conf b/root/etc/ssh/sshd_config.d/port.conf new file mode 100644 index 0000000..1e0174b --- /dev/null +++ b/root/etc/ssh/sshd_config.d/port.conf @@ -0,0 +1 @@ +Port 1337 diff --git a/root/home/user/.config/nixpkgs/config.nix b/root/home/user/.config/nixpkgs/config.nix new file mode 100644 index 0000000..17f4ff7 --- /dev/null +++ b/root/home/user/.config/nixpkgs/config.nix @@ -0,0 +1,82 @@ +{ + packageOverrides = pkgs: with pkgs; rec { + # export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin + # export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man + #''; + work = pkgs.buildEnv { + name = "workpackages"; + paths = [ + basePackages + adminPackages + ]; + pathsToLink = [ "/share/man" "/share/doc" "/bin" "/etc" ]; + extraOutputsToInstall = [ "man" "doc" ]; + }; + adminPackages = pkgs.buildEnv { + name = "adminPackages"; + paths = [ + awscli2 + byobu + cmake + cdrkit + envdir + figlet + httpie + jq + libvirt + llvm + mosh + mutt + nmap + openssl + pv + rsync + runit + terraform_0_13 + tmux + wget + xz + ]; + pathsToLink = [ "/share/man" "/share/doc" "/bin" "/etc" ]; + extraOutputsToInstall = [ "man" "doc" ]; + }; + basePackages = pkgs.buildEnv { + name = "my-packages"; + paths = [ + adminPackages + aria2 + byobu + cmus + coreutils-prefixed + envdir + ffmpeg + gnupg + go + httpie + jq + neofetch + neovim + nmap + nodejs + openssl + par2cmdline + pv + pwgen + rsync + runit + tmux + tor + vim + vimpager + weechat + wget + xz + yarn + zsh + ]; + pathsToLink = [ "/share/man" "/share/doc" "/bin" "/etc" ]; + extraOutputsToInstall = [ "man" "doc" ]; + }; + }; +} + diff --git a/root/home/user/.config/nvim/init.vim b/root/home/user/.config/nvim/init.vim new file mode 100644 index 0000000..756d68b --- /dev/null +++ b/root/home/user/.config/nvim/init.vim @@ -0,0 +1,266 @@ +" this has to be first apparently? +" i had problems when it was lower in the file. +let mapleader="," + +silent !mkdir -p ~/Library/vim/plug > /dev/null 2>&1 +silent !mkdir -p ~/Library/vim/backup > /dev/null 2>&1 +silent !mkdir -p ~/Library/vim/undo > /dev/null 2>&1 +silent !mkdir -p ~/Library/vim/swap > /dev/null 2>&1 +silent !mkdir -p ~/.paths/sneak-sync/dotfiles/vim/autoload > /dev/null 2>&1 +silent !mkdir -p ~/.paths/sneak-sync/dotfiles/vim/plugged > /dev/null 2>&1 + +if empty(glob('~/Library/vim/plug/plug.vim')) + silent !curl -fLo ~/Library/vim/plug/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +endif + +source ~/Library/vim/plug/plug.vim + +"Plug 'zchee/deoplete-go', { 'for': 'go' } +"Plug 'zchee/deoplete-jedi', { 'for': 'python' } + +call plug#begin('~/Library/vim/plug') + +if has('nvim') + Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } + Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'} + Plug 'roxma/nvim-yarp' + Plug 'roxma/vim-hug-neovim-rpc' + let g:deoplete#enable_at_startup = 1 +endif + +Plug 'nathanaelkane/vim-indent-guides' +let g:indent_guides_enable_on_vim_startup = 1 + +Plug 'tpope/vim-sensible' +Plug 'preservim/nerdtree' +Plug 'ryanoasis/vim-devicons' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' } +Plug 'prettier/vim-prettier', { + \ 'do': 'yarn install', + \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] } + +let g:prettier#autoformat = 1 +let g:prettier#autoformat_require_pragma = 0 + + +"Plug 'fatih/molokai' +Plug 'morhetz/gruvbox' +Plug 'sbdchd/neoformat' +Plug 'LnL7/vim-nix' + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" syntastic +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +Plug 'vim-syntastic/syntastic' + + +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* +let g:syntastic_always_populate_loc_list = 1 +let g:syntastic_auto_loc_list = 1 +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 +let g:syntastic_go_checkers = ['go'] + +call plug#end() + +let g:rehash256 = 1 +let g:molokai_original = 1 +let g:gruvbox_italic = 1 +"colorscheme molokai +colorscheme gruvbox + +noremap w :w +noremap i +noremap l :GoMetaLinter +noremap b :GoBuild +noremap f :Neoformat +noremap t :NERDTreeToggle + + +" vim-go golang configuration: +let g:go_fmt_fail_silently = 0 +let g:go_fmt_command = "goimports" +let g:go_addtags_transform = "camelcase" +let g:go_highlight_types = 1 +let g:go_highlight_fields = 1 +let g:go_highlight_functions = 1 +let g:go_highlight_function_calls = 1 +let g:go_highlight_extra_types = 1 + +let g:go_def_mode='gopls' +let g:go_info_mode='gopls' +let g:go_auto_type_info = 1 + + +"highlight SyntasticErrorSign guifg=white guibg=red + +"Plug 'scrooloose/nerdtree' +"Plug 'ludovicchabant/vim-gutentags' + +let g:gutentags_ctags_tagfile = '.tags' +let g:gutentags_file_list_command = 'git ls-files' +let g:gutentags_generate_on_new = 1 + +"Plug 'majutsushi/tagbar' +"Plug 'fatih/vim-go', { 'do': 'GoUpdateBinaries', 'for': 'go' } +"Plug 'cespare/vim-toml', { 'for': 'toml' } +"call plug#end() + + +let g:airline_powerline_fonts = 1 + +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif + +" unicode symbols +" let g:airline_left_sep = '▶' +" let g:airline_right_sep = '◀' + let g:airline_symbols.crypt = '🔒' + let g:airline_symbols.linenr = '☰' +" let g:airline_symbols.linenr = '␊' +" let g:airline_symbols.linenr = '␤' +" let g:airline_symbols.linenr = '¶' +" let g:airline_symbols.maxlinenr = '' +" let g:airline_symbols.maxlinenr = '㏑' +" let g:airline_symbols.branch = '⎇' +" let g:airline_symbols.paste = 'ρ' +" let g:airline_symbols.paste = 'Þ' +" let g:airline_symbols.paste = '∥' +" let g:airline_symbols.spell = 'Ꞩ' +" let g:airline_symbols.notexists = 'Ɇ' +" let g:airline_symbols.whitespace = 'Ξ' + +fun! InitBex() + let myvar = strftime("%y%m%d.%Hh%M") + let myvar = "set backupext=.". myvar + execute myvar +endfun +map :call InitBex() +silent call InitBex() + +set relativenumber +filetype plugin indent on +syntax on + +set modelines=10 +"noremap "" +"noremap! +"noremap "" +"noremap! +"noremap "" +"noremap! +"noremap "" +"noremap! +"vnoremap > >gv +"vnoremap < <gv + +"au BufWinLeave * silent! mkview +"au BufWinEnter * silent! loadview + +au BufRead,BufNewFile *.go set filetype=go +"au BufRead,BufNewFile *.coffee set filetype=coffee + + +set ignorecase +set smartcase +set gdefault +set incsearch +set showmatch +set hlsearch +"nnoremap :noh + +set bg=dark +set ignorecase +set smartcase +set gdefault +set incsearch +set showmatch +set hlsearch +set autoindent +"set signcolumn=yes +set backspace=indent,eol,start +set backup +set backupdir=~/Library/vim/backup// +set cmdheight=3 +"set clipboard=unnamed +set directory=~/Library/vim/swap// +set encoding=utf-8 +set expandtab +set fileencodings=utf-8 +set guifont=Monaco:h16 +set hidden +set ignorecase +set laststatus=2 +set modeline +set nobomb +set nocompatible +set shiftwidth=4 +set showcmd +set smartcase +set smarttab +set softtabstop=4 +set spellfile=~/.paths/sneak-sync/dotfiles/vim/spellfile.utf-8.add +set spelllang=en +set tabstop=4 +set termencoding=utf-8 +set ttyfast +set tw=76 +set undodir=~/Library/vim/undo// +set undofile +set wildignore+=*.pyc +set writebackup + +setglobal fileencoding=utf-8 + +autocmd FileType make setlocal noexpandtab +autocmd FileType markdown setlocal spell +au BufNewFile,BufFilePre,BufRead *.md set filetype=markdown +autocmd BufNewFile,BufRead *.json set ft=javascript + +autocmd BufWritePre *.js Neoformat +autocmd BufWritePre *.jsx Neoformat +autocmd BufWritePre *.json Neoformat +autocmd BufWritePre *.css Neoformat + +"inoremap jj + +"map N Nzz +"map n nzz +"map +"colorscheme koehler +hi CursorLine term=none cterm=none ctermbg=none +set t_Co=256 +set foldmethod=indent +set foldminlines=5 +set nofoldenable "dont fold by default +set foldlevel=1 "this is just what i use + +"nnoremap @=(foldlevel('.')?'za':'l') +"vnoremap zf + +nnoremap :bn +nnoremap :bp +nnoremap :ls + +highlight ExtraWhitespace ctermbg=red guibg=red +match ExtraWhitespace /\s\+$/ +autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ +autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@/dev/null 2>&1 >/dev/null ; then + gcloud config set disable_usage_reporting true >/dev/null 2>&1 +fi diff --git a/root/home/user/.local/profile.d/200.gitconfig.sh b/root/home/user/.local/profile.d/200.gitconfig.sh new file mode 100644 index 0000000..c2d7692 --- /dev/null +++ b/root/home/user/.local/profile.d/200.gitconfig.sh @@ -0,0 +1 @@ +git config --global push.default matching diff --git a/root/home/user/.local/profile.d/200.pyenv.sh b/root/home/user/.local/profile.d/200.pyenv.sh new file mode 100644 index 0000000..99e56b2 --- /dev/null +++ b/root/home/user/.local/profile.d/200.pyenv.sh @@ -0,0 +1,6 @@ +export PYENV_ROOT="$HOME/.pyenv" +export PATH="$PYENV_ROOT/bin:$PATH" + +if which pyenv 2>&1 > /dev/null ; then + eval "$(pyenv init -)" +fi diff --git a/root/home/user/.local/profile.d/300.nvm.sh b/root/home/user/.local/profile.d/300.nvm.sh new file mode 100644 index 0000000..f5bc89a --- /dev/null +++ b/root/home/user/.local/profile.d/300.nvm.sh @@ -0,0 +1,5 @@ +export NVM_DIR="$HOME/.nvm" + +if [[ -e "$NVM_DIR/nvm.sh" ]]; then + source "$NVM_DIR/nvm.sh" +fi diff --git a/root/home/user/.local/profile.d/999.bash-history.sh b/root/home/user/.local/profile.d/999.bash-history.sh new file mode 100644 index 0000000..de67ceb --- /dev/null +++ b/root/home/user/.local/profile.d/999.bash-history.sh @@ -0,0 +1,19 @@ +if [ -n "$BASH_VERSION" ]; then + +HISTSIZE=10000 +# Save 2,000,000 lines of history to disk (will have to grep ~/.bash_history for full listing) +HISTFILESIZE=2000000 +# Append to history instead of overwrite +shopt -s histappend +# Ignore redundant or space commands +HISTCONTROL=ignoreboth +# Ignore more +HISTIGNORE='ls:ll:ls -alh:pwd:clear:history' +# Set time format +HISTTIMEFORMAT='%F %T ' +# Multiple commands on one line show up as a single line +shopt -s cmdhist +# Append new history lines, clear the history list, re-read the history list, print prompt. +export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" + +fi diff --git a/root/home/user/.local/profile.d/999.kubectl.sh b/root/home/user/.local/profile.d/999.kubectl.sh new file mode 100644 index 0000000..b8b0893 --- /dev/null +++ b/root/home/user/.local/profile.d/999.kubectl.sh @@ -0,0 +1,8 @@ +if [ -n "$BASH_VERSION" ]; then + if which kubectl 2>&1 > /dev/null ; then + source <(kubectl completion bash) + fi + + alias k=kubectl + complete -F __start_kubectl k +fi diff --git a/root/home/user/.local/profile.d/999.zsh-git-prompt.sh b/root/home/user/.local/profile.d/999.zsh-git-prompt.sh new file mode 100644 index 0000000..feee7b5 --- /dev/null +++ b/root/home/user/.local/profile.d/999.zsh-git-prompt.sh @@ -0,0 +1,9 @@ +ZGP="$HOME/Library/Homebrew/opt/zsh-git-prompt/zshrc.sh" +if [ -n "$ZSH_VERSION" ]; then + if [[ -e "$ZGP" ]]; then + source "$ZGP" + fi + export PROMPT='%m:%~ $(git_super_status)$ ' +fi + + diff --git a/root/home/user/.local/profile.d/999.zsh-ls-linux-colors.sh b/root/home/user/.local/profile.d/999.zsh-ls-linux-colors.sh new file mode 100644 index 0000000..7e794dc --- /dev/null +++ b/root/home/user/.local/profile.d/999.zsh-ls-linux-colors.sh @@ -0,0 +1 @@ +export LSCOLORS=ExGxBxDxCxEgEdxbxgxcxd diff --git a/root/home/user/.local/share/terraform/plugins/registry.terraform.io/dmacvicar/libvirt/0.6.2/linux_amd64/terraform-provider-libvirt b/root/home/user/.local/share/terraform/plugins/registry.terraform.io/dmacvicar/libvirt/0.6.2/linux_amd64/terraform-provider-libvirt new file mode 100755 index 0000000..43367c8 Binary files /dev/null and b/root/home/user/.local/share/terraform/plugins/registry.terraform.io/dmacvicar/libvirt/0.6.2/linux_amd64/terraform-provider-libvirt differ diff --git a/root/home/user/.toprc b/root/home/user/.toprc new file mode 100644 index 0000000..31522b4 --- /dev/null +++ b/root/home/user/.toprc @@ -0,0 +1,16 @@ +top's Config File (Linux processes with windows) +Id:i, Mode_altscr=0, Mode_irixps=1, Delay_time=1.0, Curwin=0 +Def fieldscur=ķ&')*+,-./012568<>?ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij + winflags=162740, sortindx=18, maxtasks=0, graph_cpus=2, graph_mems=0 + summclr=1, msgsclr=1, headclr=3, taskclr=1 +Job fieldscur=(Ļ@<)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij + winflags=195508, sortindx=0, maxtasks=0, graph_cpus=2, graph_mems=0 + summclr=6, msgsclr=6, headclr=7, taskclr=6 +Mem fieldscur=?@ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij + winflags=195380, sortindx=3, maxtasks=0, graph_cpus=2, graph_mems=0 + summclr=3, msgsclr=3, headclr=2, taskclr=3 +Fixed_widest=0, Summ_mscale=0, Task_mscale=0, Zero_suppress=0 + diff --git a/root/home/user/.vimrc b/root/home/user/.vimrc new file mode 100644 index 0000000..b7fd917 --- /dev/null +++ b/root/home/user/.vimrc @@ -0,0 +1,253 @@ +" this has to be first apparently? +" i had problems when it was lower in the file. +let mapleader="," + +silent !mkdir -p ~/Library/vim/plug > /dev/null 2>&1 +silent !mkdir -p ~/Library/vim/backup > /dev/null 2>&1 +silent !mkdir -p ~/Library/vim/undo > /dev/null 2>&1 +silent !mkdir -p ~/Library/vim/swap > /dev/null 2>&1 +silent !mkdir -p ~/.paths/sneak-sync/dotfiles/vim/autoload > /dev/null 2>&1 +silent !mkdir -p ~/.paths/sneak-sync/dotfiles/vim/plugged > /dev/null 2>&1 + +if empty(glob('~/Library/vim/plug/plug.vim')) + silent !curl -fLo ~/Library/vim/plug/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +endif + +source ~/Library/vim/plug/plug.vim + +"Plug 'zchee/deoplete-go', { 'for': 'go' } +"Plug 'zchee/deoplete-jedi', { 'for': 'python' } + +call plug#begin('~/Library/vim/plug') + +if has('nvim') + Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } + Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'} + Plug 'roxma/nvim-yarp' + Plug 'roxma/vim-hug-neovim-rpc' + let g:deoplete#enable_at_startup = 1 +endif + +Plug 'tpope/vim-sensible' +Plug 'preservim/nerdtree' +Plug 'ryanoasis/vim-devicons' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' } +"Plug 'fatih/molokai' +Plug 'morhetz/gruvbox' +Plug 'sbdchd/neoformat' +Plug 'LnL7/vim-nix' + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" syntastic +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +Plug 'vim-syntastic/syntastic' +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* +let g:syntastic_always_populate_loc_list = 1 +let g:syntastic_auto_loc_list = 1 +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 +let g:syntastic_go_checkers = ['go'] + +call plug#end() + +let g:rehash256 = 1 +let g:molokai_original = 1 +let g:gruvbox_italic = 1 +"colorscheme molokai +colorscheme gruvbox + +noremap w :w +noremap i +noremap l :GoMetaLinter +noremap b :GoBuild +noremap f :Neoformat +noremap t :NERDTreeToggle + + +" vim-go golang configuration: +let g:go_fmt_fail_silently = 0 +let g:go_fmt_command = "goimports" +let g:go_addtags_transform = "camelcase" +let g:go_highlight_types = 1 +let g:go_highlight_fields = 1 +let g:go_highlight_functions = 1 +let g:go_highlight_function_calls = 1 +let g:go_highlight_extra_types = 1 + +let g:go_def_mode='gopls' +let g:go_info_mode='gopls' +let g:go_auto_type_info = 1 + + +"highlight SyntasticErrorSign guifg=white guibg=red + +"Plug 'scrooloose/nerdtree' +"Plug 'ludovicchabant/vim-gutentags' + +let g:gutentags_ctags_tagfile = '.tags' +let g:gutentags_file_list_command = 'git ls-files' +let g:gutentags_generate_on_new = 1 + +"Plug 'majutsushi/tagbar' +"Plug 'fatih/vim-go', { 'do': 'GoUpdateBinaries', 'for': 'go' } +"Plug 'cespare/vim-toml', { 'for': 'toml' } +"call plug#end() + + +let g:airline_powerline_fonts = 1 + +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif + +" unicode symbols +" let g:airline_left_sep = '▶' +" let g:airline_right_sep = '◀' + let g:airline_symbols.crypt = '🔒' + let g:airline_symbols.linenr = '☰' +" let g:airline_symbols.linenr = '␊' +" let g:airline_symbols.linenr = '␤' +" let g:airline_symbols.linenr = '¶' +" let g:airline_symbols.maxlinenr = '' +" let g:airline_symbols.maxlinenr = '㏑' +" let g:airline_symbols.branch = '⎇' +" let g:airline_symbols.paste = 'ρ' +" let g:airline_symbols.paste = 'Þ' +" let g:airline_symbols.paste = '∥' +" let g:airline_symbols.spell = 'Ꞩ' +" let g:airline_symbols.notexists = 'Ɇ' +" let g:airline_symbols.whitespace = 'Ξ' + +fun! InitBex() + let myvar = strftime("%y%m%d.%Hh%M") + let myvar = "set backupext=.". myvar + execute myvar +endfun +map :call InitBex() +silent call InitBex() + +set relativenumber +filetype plugin indent on +syntax on + +set modelines=10 +"noremap "" +"noremap! +"noremap "" +"noremap! +"noremap "" +"noremap! +"noremap "" +"noremap! +"vnoremap > >gv +"vnoremap < <gv + +"au BufWinLeave * silent! mkview +"au BufWinEnter * silent! loadview + +au BufRead,BufNewFile *.go set filetype=go +"au BufRead,BufNewFile *.coffee set filetype=coffee + + +set ignorecase +set smartcase +set gdefault +set incsearch +set showmatch +set hlsearch +"nnoremap :noh + +set bg=dark +set ignorecase +set smartcase +set gdefault +set incsearch +set showmatch +set hlsearch +set autoindent +"set signcolumn=yes +set backspace=indent,eol,start +set backup +set backupdir=~/Library/vim/backup// +set cmdheight=3 +"set clipboard=unnamed +set directory=~/Library/vim/swap// +set encoding=utf-8 +set expandtab +set fileencodings=utf-8,iso-8859-15 +set guifont=Monaco:h16 +set hidden +set ignorecase +set laststatus=2 +set modeline +set nobomb +set nocompatible +set shiftwidth=4 +set showcmd +set smartcase +set smarttab +set softtabstop=4 +set spellfile=~/.paths/sneak-sync/dotfiles/vim/spellfile.utf-8.add +set spelllang=en +set tabstop=4 +set termencoding=utf-8 +set ttyfast +set tw=76 +set undodir=~/Library/vim/undo// +set undofile +set wildignore+=*.pyc +set writebackup + +setglobal fileencoding=utf-8 + +autocmd FileType make setlocal noexpandtab +autocmd FileType markdown setlocal spell +au BufNewFile,BufFilePre,BufRead *.md set filetype=markdown +autocmd BufNewFile,BufRead *.json set ft=javascript + +autocmd BufWritePre *.js Neoformat +autocmd BufWritePre *.jsx Neoformat +autocmd BufWritePre *.json Neoformat +autocmd BufWritePre *.css Neoformat + +"inoremap jj + +"map N Nzz +"map n nzz +"map +"colorscheme koehler +hi CursorLine term=none cterm=none ctermbg=none +set t_Co=256 +set foldmethod=indent +set foldminlines=5 +set nofoldenable "dont fold by default +set foldlevel=1 "this is just what i use + +"nnoremap @=(foldlevel('.')?'za':'l') +"vnoremap zf + +nnoremap :bn +nnoremap :bp +nnoremap :ls + +highlight ExtraWhitespace ctermbg=red guibg=red +match ExtraWhitespace /\s\+$/ +autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ +autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@?ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij + winflags=162740, sortindx=18, maxtasks=0, graph_cpus=2, graph_mems=0 + summclr=1, msgsclr=1, headclr=3, taskclr=1 +Job fieldscur=(Ļ@<)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij + winflags=195508, sortindx=0, maxtasks=0, graph_cpus=2, graph_mems=0 + summclr=6, msgsclr=6, headclr=7, taskclr=6 +Mem fieldscur=?@ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij + winflags=195380, sortindx=3, maxtasks=0, graph_cpus=2, graph_mems=0 + summclr=3, msgsclr=3, headclr=2, taskclr=3 +Fixed_widest=0, Summ_mscale=0, Task_mscale=0, Zero_suppress=0 + diff --git a/setup/packages.txt b/setup/packages.txt deleted file mode 100644 index a8445d2..0000000 --- a/setup/packages.txt +++ /dev/null @@ -1,110 +0,0 @@ - -apt-transport-https -apt-utils -aspell -aspell-en -automake -bash-completion -bc -bind9-host -bonnie++ -build-essential -byobu -ca-certificates -cmake -command-not-found -curl -daemontools -debmirror -default-jre -diffstat -dnsutils -docker.io -dos2unix -editorconfig -ffmpeg -fonts-indic -fonts-ipafont-gothic -fonts-ipafont-mincho -fortune -git -gnupg2 -gnupg-agent -golang-go -host -imagemagick -iputils-ping -irssi -jq -lcov -ldap-auth-client -ldap-utils -libasound2 -libatk1.0-0 -libboost-all-dev -libdb++-dev -libgconf-2-4 -libgtk-3-0 -libjpeg-dev -libnss3 -libnss-mdns -libpng-dev -libssl-dev -libtool -libxcursor1 -libxml2 -libxml2-dev -libxslt1-dev -locales -lsof -mailutils -make -man -man-db -mercurial -mosh -mutt -netcat-openbsd -nmap -nscd -openssh-server -pandoc -pass -pbzip2 -pinentry-curses -pkg-config -psmisc -pv -pwgen -python3 -python3-dev -python3-pip -rbenv -rsync -rsyslog -rsyslog-gnutls -rsyslog-relp -runit -screen -snmp -snmpd -socat -software-properties-common -strace -sudo -tcpdump -telnet -texlive-latex-base -tmux -tree -ttf-wqy-microhei -ttf-wqy-zenhei -vagrant -vim -vim-gtk -wamerican-insane -wget -xterm -zfsutils-linux -zip -zsh diff --git a/setup/run.sh b/setup/run.sh deleted file mode 100644 index 888ce04..0000000 --- a/setup/run.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -TD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" - -cd "$TD" - -apt install -y $(cat packages.txt) diff --git a/user.sh b/user.sh new file mode 100644 index 0000000..09aea44 --- /dev/null +++ b/user.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +set -x + +TD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +U="user" + +export HOME=/home/user +export USER=user +export LC_ALL=en_US +export LANG=en_US.UTF-8 + +# original home +OH="/hosthome" +# link ~/.home to original home +ln -s "/hosthome" $HOME/.home + +cd $HOME && ls -tla + +# /nix is already created for us and chowned to us by now: +curl -L https://nixos.org/nix/install | sh + +source /home/user/.nix-profile/etc/profile.d/nix.sh + +# this should install all the packages from the config.nix: +nix-env -iA nixpkgs.work +nix-env --set-flag priority 7 workpackages + +# FIXME have this pull from synced dir instead +# oh-my-zsh +curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh > /tmp/installomz.sh +export ZSH="$HOME/.zsh" +export KEEP_ZSHRC=yes +zsh /tmp/installomz.sh && rm /tmp/installomz.sh + +############################################################################### +##### Personal Config +############################################################################### +# I had envisioned this image as adaptable to other users but I've decided +# to abandon that hope and hardcode my own values in here. +git config --global user.email sneak@sneak.berlin +git config --global user.name sneak + +mkdir -p ~/.paths +# TODO FIXME change the syncthing paths on las1 when convenient sometime +ln -s ~/.home/Library/Syncthing/folders/sync ~/.paths/sneak-sync +ln -s ~/.home/Library/Syncthing/folders/scratch ~/.paths/sneak-scratch +ln -s ~/.home/Library/Syncthing/folders/sneak-docs ~/.paths/sneak-docs +ln -s ~/.paths/sneak-docs ~/Documents +ln -s ~/.paths/sneak-scratch/dev ~/dev +ln -s ~/.paths/sneak-sync/dotfiles/weechat ~/.weechat +ln -s ~/.paths/sneak-sync/ssh/config ~/.ssh/config + +# link in ssh key from original home +mkdir -p ~/.ssh +ln -s ~/.paths/sneak-sync/secrets/ssh/pixel16/id_rsa ~/.ssh/id_rsa +ln -s ~/.paths/sneak-sync/secrets/ssh/pixel16/id_rsa.pub ~/.ssh/id_rsa.pub + + +# vim plug preinstallation +# newline is to fix "hit ENTER" issue when it can't find the colorscheme file +# which PlugInstall is about to install +# this needs to happen after the linking above +echo "" | vim +PlugInstall +qall +vim +GoInstallBinaries +qall +vim +PlugInstall +qall + +rm ~/.vimrc +ln -s ~/.paths/sneak-sync/dotfiles/vim/vimrc ~/.vimrc + +mkdir -p ~/.config/nvim +ln -s ~/.paths/sneak-sync/dotfiles/vim/vimrc ~/.config/nvim/init.vim + +mkdir -p ~/.local/share/terraform/plugins/registry.terraform.io/dmacvicar/libvirt/0.6.2/linux_amd64 +cd ~/.local/share/terraform/plugins/registry.terraform.io/dmacvicar/libvirt/0.6.2/linux_amd64 + +