latest
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
Jeffrey Paul 2021-10-14 02:04:14 -07:00
parent abb7405b4c
commit 27febcbc4d
12 changed files with 239 additions and 239 deletions

View File

@ -3,129 +3,6 @@ FROM sneak/workbase
# nix for pkgs pls
RUN mkdir /nix && chown user:user /nix
ARG OTHER_PACKAGES=" \
apt-utils \
aspell \
aspell-en \
automake \
avahi-daemon \
avahi-utils \
bash-completion \
bc \
bind9-host \
bonnie++ \
build-essential \
byobu \
ca-certificates \
cmake \
curl \
daemontools \
debmirror \
default-jdk \
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 \
libbz2-dev \
libdb++-dev \
libffi-dev \
libgconf-2-4 \
libgtk-3-0 \
libjpeg-dev \
liblzma-dev \
libncurses5-dev \
libnss3 \
libnss-mdns \
libpng-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libtool \
libxcursor1 \
libxml2 \
libxml2-dev \
libxmlsec1-dev \
libxslt1-dev \
llvm \
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 \
screen \
snmp \
snmpd \
socat \
software-properties-common \
strace \
sudo \
tcpdump \
telnet \
texlive-latex-base \
tk-dev \
tmux \
tree \
ttf-wqy-microhei \
ttf-wqy-zenhei \
vagrant \
vim \
vim-gtk \
wamerican-insane \
wget \
xterm \
xz-utils \
zfsutils-linux \
zip \
zlib1g-dev \
"
#RUN apt -y install $OTHER_PACKAGES
USER root
ENV HOME /root

View File

@ -1,26 +1,32 @@
export DOCKER_HOST := ssh://root@datavi.be
export DOCKER_HOST := ssh://root@meatfucker.local
default: start
default: build
.PHONY: build run
.PHONY: build run base full release
start:
make build
make run
build:
docker build --squash -t sneak/work .
full:
cd base && make build
docker build -t sneak/work .
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
enter:
docker run -ti --rm=true -e HOME=/home/user -e USER=user --user=user -v /home/sneak:/home/user/.home sneak/work /home/user/.nix-profile/bin/zsh -l
release:
make full && make run

View File

@ -1,5 +1,5 @@
# focal as of 2020-04-23
FROM ubuntu:focal-20201008
#FROM ubuntu:focal-20201008
FROM ubuntu@sha256:1d7b639619bdca2d008eca2d5293e3c43ff84cbee597ff76de3b7a7de3e84956
ENV DEBIAN_FRONTEND noninteractive
@ -9,12 +9,13 @@ ARG UID_TO_ADD=1000
ARG GID_TO_ADD=1000
ARG USERNAME_TO_ADD=user
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 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 && \
@ -28,18 +29,24 @@ 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
sudo \
vim \
zsh
RUN /bin/bash -c "echo -e 'Y\n\n' | /usr/local/sbin/unminimize"
@ -48,6 +55,9 @@ RUN \
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"]

View File

@ -3,4 +3,4 @@ default: build
.PHONY: build
build:
docker build -t sneak/workbase .
docker build --squash -t sneak/workbase .

View File

@ -1,15 +0,0 @@
#!/bin/bash
pushd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)/../"
docker build -t sneak/work .
popd
docker rm -f work
# FIXME ssh host keys
docker run \
-d \
--name work \
-v /:/hostroot \
-v /home/sneak:/hosthome \
-v /var/run/docker.sock:/var/run/docker.sock \
sneak/work

17
root.sh
View File

@ -26,10 +26,11 @@ 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
#ln -s /hostroot/root /root/.home
# install other stuff here
@ -42,9 +43,19 @@ ln -s /hostroot/root /root/.home
# 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 $UID_TO_ADD:$GID_TO_ADD /home/user
echo "$USERNAME_TO_ADD ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/user
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

View File

@ -1,3 +1,4 @@
#!/bin/bash
mkdir -p /run/sshd
exec /usr/sbin/sshd -D

View File

@ -1,45 +1,82 @@
{
packageOverrides = pkgs: with pkgs; {
myPackages = pkgs.buildEnv {
name = "myPackages";
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 = [
aspell
bc
clang
coreutils
ctags
curl
docker
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
gdb
git
gnupg
gnupg
go
gpg-agent
httpie
jq
nix-prefetch-scripts
neofetch
neovim
nmap
openssh
nodejs
openssl
par2cmdline
pinentry-mac
pv
pwgen
qemu
rsync
runit
tmux
tor
tree
vim
vimpager
weechat
wget
whois
xz
yarn
zsh
];
];
pathsToLink = [ "/share/man" "/share/doc" "/bin" "/etc" ];
extraOutputsToInstall = [ "man" "doc" ];
};
};
}

View File

@ -1,3 +1,4 @@
alias unsafessh="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
alias prettier="prettier --tab-width 4"
alias gencapkey="ssh-keygen -m PEM -t rsa -b 2048 -C \"caprover\" -f ./key -q -N \"\""
alias nixup="nix-channel --update && nix-env -iA nixpkgs.$(hostname -s)"

View File

@ -1,43 +1,93 @@
"execute pathogen#infect()
" this has to be first apparently?
" i had problems when it was lower in the file.
let mapleader=","
silent !mkdir -p ~/.vim/backup > /dev/null 2>&1
silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
silent !mkdir -p ~/.vim/swap > /dev/null 2>&1
silent !mkdir -p ~/.vim/autoload > /dev/null 2>&1
silent !mkdir -p ~/.vim/plugged > /dev/null 2>&1
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('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
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 ~/.vim/autoload/plug.vim
source ~/Library/vim/plug/plug.vim
call plug#begin('~/.vim/plugged')
"Plug 'zchee/deoplete-go', { 'for': 'go' }
"Plug 'zchee/deoplete-jedi', { 'for': 'python' }
" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" Plug 'roxma/vim-hug-neovim-rpc'
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 'edkolev/tmuxline.vim'
Plug 'zchee/deoplete-go', { 'for': 'go' }
Plug 'zchee/deoplete-jedi', { 'for': 'python' }
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+=%{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 = ['gofmt']
let g:syntastic_enable_signs = 1
highlight SyntasticErrorSign guifg=white guibg=red
let g:syntastic_go_checkers = ['go']
Plug 'scrooloose/nerdtree'
call plug#end()
let g:rehash256 = 1
let g:molokai_original = 1
let g:gruvbox_italic = 1
"colorscheme molokai
colorscheme gruvbox
noremap <Leader>w :w<cr>
noremap <Leader><cr> i<cr><Esc>
noremap <Leader>l :GoMetaLinter<cr>
noremap <Leader>b :GoBuild<cr>
noremap <Leader>f :Neoformat<cr>
noremap <Leader>t :NERDTreeToggle<CR>
" 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'
@ -45,10 +95,10 @@ 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' }
let g:deoplete#enable_at_startup = 1
call plug#end()
"Plug 'fatih/vim-go', { 'do': 'GoUpdateBinaries', 'for': 'go' }
"Plug 'cespare/vim-toml', { 'for': 'toml' }
"call plug#end()
let g:airline_powerline_fonts = 1
@ -79,7 +129,7 @@ fun! InitBex()
let myvar = "set backupext=.". myvar
execute myvar
endfun
map <silent> <Esc> :call InitBex()<CR>
map <silent> <Esc>:call InitBex()<CR>
silent call InitBex()
set relativenumber
@ -87,16 +137,16 @@ filetype plugin indent on
syntax on
set modelines=10
noremap <Up> ""
noremap! <Up> <Esc>
noremap <Down> ""
noremap! <Down> <Esc>
noremap <Left> ""
noremap! <Left> <Esc>
noremap <Right> ""
noremap! <Right> <Esc>
vnoremap > ><CR>gv
vnoremap < <<CR>gv
"noremap <Up> ""
"noremap! <Up> <Esc>
"noremap <Down> ""
"noremap! <Down> <Esc>
"noremap <Left> ""
"noremap! <Left> <Esc>
"noremap <Right> ""
"noremap! <Right> <Esc>
"vnoremap > ><CR>gv
"vnoremap < <<CR>gv
"au BufWinLeave * silent! mkview
"au BufWinEnter * silent! loadview
@ -104,7 +154,6 @@ vnoremap < <<CR>gv
au BufRead,BufNewFile *.go set filetype=go
"au BufRead,BufNewFile *.coffee set filetype=coffee
let mapleader=","
set ignorecase
set smartcase
@ -112,8 +161,9 @@ set gdefault
set incsearch
set showmatch
set hlsearch
nnoremap <leader><space> :noh<cr>
"nnoremap <leader><space> :noh<cr>
set bg=dark
set ignorecase
set smartcase
set gdefault
@ -124,10 +174,10 @@ set autoindent
"set signcolumn=yes
set backspace=indent,eol,start
set backup
set backupdir=~/.vim/backup//
set backupdir=~/Library/vim/backup//
set cmdheight=3
"set clipboard=unnamed
set directory=~/.vim/swap//
set directory=~/Library/vim/swap//
set encoding=utf-8
set expandtab
set fileencodings=utf-8,iso-8859-15
@ -143,13 +193,13 @@ set showcmd
set smartcase
set smarttab
set softtabstop=4
set spellfile=~/.vim/spellfile.utf-8.add
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=~/.vim/undo//
set undodir=~/Library/vim/undo//
set undofile
set wildignore+=*.pyc
set writebackup
@ -161,12 +211,17 @@ 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 <Esc>
map N Nzz
map n nzz
"map N Nzz
"map n nzz
"map <s-tab> <c-w><c-w>
colorscheme koehler
"colorscheme koehler
hi CursorLine term=none cterm=none ctermbg=none
set t_Co=256
set foldmethod=indent
@ -177,9 +232,9 @@ set foldlevel=1 "this is just what i use
"nnoremap <silent> <Space> @=(foldlevel('.')?'za':'l')<CR>
"vnoremap <Space> zf
"nnoremap <silent> <Tab> :bn<CR>
"nnoremap <silent> <Backspace> :bp<CR>
"nnoremap <silent> <Leader><Enter> :ls<CR>
nnoremap <silent> <Tab> :bn<CR>
nnoremap <silent> <Backspace> :bp<CR>
nnoremap <silent> <Leader><Enter> :ls<CR>
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/

View File

@ -68,7 +68,8 @@ HIST_STAMPS="yyyy-mm-dd"
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git git-prompt zsh-autosuggestions)
#plugins=(git git-prompt zsh-autosuggestions)
plugins=(git git-prompt)
source $ZSH/oh-my-zsh.sh

36
user.sh
View File

@ -16,11 +16,7 @@ OH="/hosthome"
# link ~/.home to original home
ln -s "/hosthome" $HOME/.home
#vim -s ~/.vimrc -c 'q!'
# vim-plug
# this should happen from vimrc
#curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
# https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
cd $HOME && ls -tla
# /nix is already created for us and chowned to us by now:
curl -L https://nixos.org/nix/install | sh
@ -28,7 +24,8 @@ 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 -i myPackages
nix-env -iA nixpkgs.work
nix-env --set-flag priority 7 workpackages
# FIXME have this pull from synced dir instead
# oh-my-zsh
@ -37,7 +34,6 @@ export ZSH="$HOME/.zsh"
export KEEP_ZSHRC=yes
zsh /tmp/installomz.sh && rm /tmp/installomz.sh
###############################################################################
##### Personal Config
###############################################################################
@ -48,9 +44,9 @@ git config --global user.name sneak
mkdir -p ~/.paths
# TODO FIXME change the syncthing paths on las1 when convenient sometime
ln -s ~/.home/Documents/syncthing/folders/sync ~/.paths/sneak-sync
ln -s ~/.home/Documents/syncthing/folders/scratch ~/.paths/sneak-scratch
ln -s ~/.home/Documents/syncthing/folders/sneak-docs ~/.paths/sneak-docs
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
@ -60,3 +56,23 @@ ln -s ~/.paths/sneak-sync/ssh/config ~/.ssh/config
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