From 6046ee27fd09049b86219120077e85903593a9fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Tue, 26 Mar 2019 09:55:52 +0000 Subject: [PATCH] Add nixos config --- .gitconfig_includes.common | 3 - common/configure_fresh_system.sh | 3 +- nixos/up.sh | 138 +++++++++++++++++++++++++++++++ tools/clipboard | 2 +- tools/mount-vault | 2 +- 5 files changed, 142 insertions(+), 6 deletions(-) create mode 100755 nixos/up.sh diff --git a/.gitconfig_includes.common b/.gitconfig_includes.common index 1536eb6d..c75d35a2 100644 --- a/.gitconfig_includes.common +++ b/.gitconfig_includes.common @@ -25,9 +25,6 @@ tool = kdiff3 [mergetool] keepBackup = false -[pager] - diff = diff-so-fancy | less --tabs=1,5 -RFX - show = diff-so-fancy | less --tabs=1,5 -RFX [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f diff --git a/common/configure_fresh_system.sh b/common/configure_fresh_system.sh index 6a0c2154..6fea9bd8 100755 --- a/common/configure_fresh_system.sh +++ b/common/configure_fresh_system.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash + set -e set -o pipefail diff --git a/nixos/up.sh b/nixos/up.sh new file mode 100755 index 00000000..ec8f81b8 --- /dev/null +++ b/nixos/up.sh @@ -0,0 +1,138 @@ +#!/usr/bin/env bash + +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +DIR=`realpath "$DIR/../"` + +echo "linking and sourcing env" +ln -vfs "$DIR/.setenv.sh" ~/.setenv +source ~/.setenv + +CURL="curl -sSfL" + +if [[ -z $DIR ]]; then + echo "please set DIR" + exit 1 +fi + +DIR=`realpath $DIR` +echo "using $DIR as the top level directory" +cd $DIR +git submodule update --init --recursive + +#configs +ln -vfs "$DIR/.vim" ~/. +ln -vfs "$DIR/.ideavimrc" ~/. +ln -vfs "$DIR/.vimrc" ~/.vimrc +ln -vfs "$DIR/rvmrc" ~/.rvmrc +ln -vfs "$DIR/.tmux.conf" ~/. +ln -vfs "$DIR/.tmux.macosx" ~/. +rm -f "~/.zshrc" +ln -vfs "$DIR/.zprezto" ~/. +ln -vfs "$DIR/.zpreztorc" ~/.zpreztorc +ln -vfs "$DIR/.zprofile" ~/.zprofile +ln -vfs "$DIR/.zprezto/runcoms/zshenv" ~/.zshenv +ln -vfs "$DIR/.zshrc" ~/.zshrc +ln -vfs "$DIR/.hyper.js" ~/.hyper.js +ln -vfs "$DIR/.hyper_plugins" ~/.hyper_plugins + +ln -vfs "$DIR/.Slic3r" ~/. +ln -vfs "$DIR/.ghci" ~/. +ln -vfs "$DIR/.conkyrc" ~/. +mkdir -p ~/.kde/share/config/ +ln -vfs "$DIR/.kdiff3rc" ~/.kde/share/config/kdiff3rc +ln -vfs "$DIR/.gitconfig.linux.private" ~/.gitconfig +mkdir -p ~/.config/autostart/ + +mkdir -p ~/.config/Code/User +ln -vfs "$DIR/.config/Code/User/settings.json" ~/.config/Code/User/settings.json +ln -vfs "$DIR/.config/Code/User/keybindings.json" ~/.config/Code/User/keybindings.json +mkdir -p ~/.local/share/applications +cp -v "$DIR/keeweb.desktop" ~/.local/share/applications/ +ln -vfs "$DIR/tools" ~/ +mkdir -vp ~/.config/terminator +rm -f ~/.config/terminator/config +ln "$DIR/.config/terminator/config" ~/.config/terminator/config +mkdir -p ~/.cargo/ +echo "all links done" + +echo "adding GDB dashboard" +wget -P ~ git.io/.gdbinit + +#install fonts +echo "installing fonts" +mkdir -p ~/.local/share/fonts +cp -rv "$DIR/fonts" ~/.local/share/fonts + +set +e +fc-cache -rv +$SUDO fc-cache -rv +set -e + +set +e +rustup update +set -e +rustup install stable +set +e +rustup install nightly +set -e +rustup default stable + +(test -x "${HOME}/.cargo/bin/cargo-install-update" || nix-shell -p gcc pkgconfig zlib openssl --run "cargo install cargo-update" ) +(test -x "${HOME}/.cargo/bin/rg" || cargo install ripgrep) +(test -x "${HOME}/.cargo/bin/fd" || cargo install fd-find) +(test -x "${HOME}/.cargo/bin/genpass" || cargo install genpass) + +set +e +nix-shell -p gcc pkgconfig zlib openssl --run "cargo install-update -a" +set -e +nix-shell -p gcc pkgconfig zlib openssl --run "rustup run nightly cargo install-update -a" + +set +e +echo "Querying for gpg2 path" +gpg2_path=`which gpg2` +echo "Got $gpg2_path for gpg2 path" +set -e +if [[ -x "$gpg2_path" ]]; then + echo "Using gpg2" + GPG=gpg2 +else + echo "WARNING using gpg instead of gpg2" + GPG=gpg +fi + +echo "Getting GPG keys.." +for key in \ + 409B6B1796C275462A1703113804BB82D39DC0E3 \ + 7D2BAF1CF37B13E2069D6956105BD0E739499BDB +do + $GPG --keyserver hkp://keys.gnupg.net --recv-keys "$key" || \ + $GPG --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ + $GPG --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ + $GPG --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" \ + ; +done + +if [[ ! -d ~/.fzf ]]; then + git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf +else + cd ~/.fzf + git pull + git submodule update --init --recursive +fi +if [[ -z $NO_GO ]]; then + echo "Installing fzf" + ~/.fzf/install --64 --all +fi +echo "Installing Vim plugins" +echo "\n" | vim +PlugClean! +qa +echo "\n" | vim +PlugInstall! +qa + +GOPATH="$HOME/go" +export GOPATH=`realpath "$GOPATH"` +mkdir -p "$GOPATH" + +# excercism +go get -u github.com/exercism/cli/exercism + diff --git a/tools/clipboard b/tools/clipboard index dea37ab4..1c1c1d02 100755 --- a/tools/clipboard +++ b/tools/clipboard @@ -1,2 +1,2 @@ -#!/bin/bash +#!/usr/bin/env bash xclip -selection clipboard diff --git a/tools/mount-vault b/tools/mount-vault index 71290882..db8ab7b1 100755 --- a/tools/mount-vault +++ b/tools/mount-vault @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e VERACRYPT="veracrypt"