Compare commits
57 Commits
blesh
...
ed643a06f9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed643a06f9 | ||
|
|
c460081637 | ||
|
|
2f971627bd | ||
|
|
55141b696b | ||
|
|
bee634eb79 | ||
|
|
bc63202425 | ||
|
|
119c751ea3 | ||
|
|
722352e607 | ||
|
|
e1d39feb7d | ||
| f64da797ce | |||
|
|
ec19718182 | ||
|
|
6e88e2b333 | ||
|
|
4c312cfa58 | ||
|
|
11e8bf4bec | ||
| a16b49a394 | |||
| 829e53d3cc | |||
| e02cdd0b66 | |||
| c2ebab9a41 | |||
| 5426e96bed | |||
| 51b8138cf3 | |||
| 790c132e07 | |||
| 008d3720ff | |||
| 85cee95c2e | |||
| 7360e32a08 | |||
| c2286bb299 | |||
| 4c48565a8f | |||
| edd3b72430 | |||
| 772da66b96 | |||
| ac168d66d7 | |||
| 8937b9f566 | |||
| c73a495540 | |||
| 406c50b4a5 | |||
| 4360067486 | |||
| b156901695 | |||
| bc00f7a310 | |||
| 16545b322f | |||
| dafc207f96 | |||
| f81ee2834a | |||
| b7ce819dba | |||
| f7b5147450 | |||
| 6246e75d81 | |||
| d901efe31a | |||
| e15f254143 | |||
| fa7af5ee1f | |||
| 819c41de45 | |||
| c97ef61d30 | |||
| 0d5d35d5e1 | |||
| 8c379c558a | |||
| 8ce45fc87c | |||
| ed9e0d4419 | |||
| dd35fe3b20 | |||
| c26f6a6bf5 | |||
| 08713c254f | |||
| 2d14e91f81 | |||
| 8dda8c7fbc | |||
| 7d67ff0662 | |||
|
|
a2076fd6f1 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
taskwarrior/.task/*.data
|
||||
ssh/.ssh/extra.conf
|
||||
|
||||
15
.gitmodules
vendored
15
.gitmodules
vendored
@@ -40,3 +40,18 @@
|
||||
[submodule "vim/.vim/bundle/ale"]
|
||||
path = vim/.vim/bundle/ale
|
||||
url = https://github.com/dense-analysis/ale
|
||||
[submodule "vim/.vim/nvim-bundle/plenary"]
|
||||
path = vim/.vim/nvim-bundle/plenary
|
||||
url = https://github.com/nvim-lua/plenary.nvim.git
|
||||
[submodule "vim/.vim/nvim-bundle/telescope"]
|
||||
path = vim/.vim/nvim-bundle/telescope
|
||||
url = https://github.com/nvim-telescope/telescope.nvim.git
|
||||
[submodule "vim/.vim/nvim-bundle/nvim-lspconfig"]
|
||||
path = vim/.vim/nvim-bundle/nvim-lspconfig
|
||||
url = https://github.com/neovim/nvim-lspconfig.git
|
||||
[submodule "vim/.vim/nvim-bundle/indent-blankline"]
|
||||
path = vim/.vim/nvim-bundle/indent-blankline
|
||||
url = https://github.com/lukas-reineke/indent-blankline.nvim.git
|
||||
[submodule "vim/.vim/nvim-bundle/LuaSnip"]
|
||||
path = vim/.vim/nvim-bundle/LuaSnip
|
||||
url = https://github.com/L3MON4D3/LuaSnip.git
|
||||
|
||||
15
README.md
Normal file
15
README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Dotfiles
|
||||
|
||||
This is my personal dotfiles repository containing all my configurations (and some credentials in git-crypt). Most of these files are managed using [GNU Stow](https://www.gnu.org/software/stow/) to symlink them into place while the real files live in this repository under version control.
|
||||
|
||||
## Installation
|
||||
|
||||
To place all the configuration files in their ultimate location we use the `apply-dotfiles` bash script. This script requires both `git` and `stow` to be available so we wrap this in either `install.sh` to install it similar to [gitpod dotfiles](https://www.gitpod.io/docs/configure/user-settings/dotfiles#custom-installation-script) (which are also used for [coder](https://coder.com/) workspaces) or `nix-install` for my many machines that have either Nix or NixOS installed.
|
||||
|
||||
## Secret Management
|
||||
|
||||
I use `git-crypt` to keep some sensitive files in this repo. Namely my taskwarrior configuration which uses locally stored certificates in it's configuration as a means of authentication. While using `git-crypt` for this is pretty functional the process of moving PGP keys around is onerous enough that I haven't put a lot of effort into automating this portion of my dotfiles. It's there, there are scripts to interact with it but it's still mostly manual right now
|
||||
|
||||
### Things to watch out for
|
||||
|
||||
As anyone who maintains their own dotfiles long enough will know, your mileage will vary depending on your target OS. You have static configuration files setup against one version of software being moved to other machines that might use older/newer versions where configuration options have changed. You might end up getting annoying warnings (common in vim) or things just might not work at all. You may have to tune things for the lowest common denominator or create alternate configurations for specific operating system.
|
||||
@@ -1,13 +1,40 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -p stow -i bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
stow bash
|
||||
stow sh
|
||||
stow readline
|
||||
apply_dotfile() {
|
||||
directory_to_stow="${1}"
|
||||
stow --adopt -S -t "${HOME}" "${directory_to_stow}"
|
||||
}
|
||||
|
||||
stow vim
|
||||
# Adopt will change the files in stow to match existing files.
|
||||
# We don't want this, we just want to handle existing files gracefully.
|
||||
# We simply adopt all the files and then at the end restore our git repo to undo changes
|
||||
restore_from_adoption() {
|
||||
git restore .
|
||||
}
|
||||
|
||||
stow ruby
|
||||
stow python
|
||||
apply_dotfile bash
|
||||
apply_dotfile sh
|
||||
apply_dotfile readline
|
||||
apply_dotfile screen
|
||||
|
||||
stow ssh
|
||||
apply_dotfile vim
|
||||
|
||||
apply_dotfile ruby
|
||||
apply_dotfile python
|
||||
|
||||
# Only if inside a coder instance
|
||||
if [ -n "${CODER}" ]; then
|
||||
apply_dotfile gnupg
|
||||
fi
|
||||
|
||||
# Check that SSH version is above 9.2 (where EnableEscapeCommandline was added) before conditionally adding
|
||||
# a config file. This is then included in the main config
|
||||
SSH_VERSION=$(ssh -V 2>&1 | cut -d',' -f 1 | cut -d '_' -f 2)
|
||||
if [[ "${SSH_VERSION}" =~ ^9\.[1-9]{0,1}[2-9].*$ ]]; then
|
||||
cat <<CONFIG > ssh/.ssh/extra.conf
|
||||
EnableEscapeCommandline yes
|
||||
CONFIG
|
||||
fi
|
||||
apply_dotfile ssh
|
||||
|
||||
restore_from_adoption
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -p stow envsubst -i bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
envsubst -i taskwarrior/.taskrc.envsubst.template -o taskwarrior/.taskrc
|
||||
stow taskwarrior
|
||||
|
||||
@@ -5,6 +5,14 @@
|
||||
# Allow alias expansion for commands executed with sudo
|
||||
alias sudo="sudo "
|
||||
|
||||
#{- VIM OPTION SELECT -}#
|
||||
if which nvim &> /dev/null; then
|
||||
export PREFERRED_VIM=nvim
|
||||
else
|
||||
export PREFERRED_VIM=vim
|
||||
fi
|
||||
alias vim="$PREFERRED_VIM "
|
||||
|
||||
#{- GNU COREUTILS -}#
|
||||
|
||||
# Sort directories first and colorize output
|
||||
@@ -37,6 +45,14 @@ alias df="df -h"
|
||||
# Human readable file size inspection
|
||||
alias du="du -sh"
|
||||
|
||||
# History searches
|
||||
alias phistory='cat ${PERSISTENT_HISTFILE}'
|
||||
alias hgrep='history | grep --color'
|
||||
alias phgrep="cat ${PERSISTENT_HISTFILE} | grep --color"
|
||||
|
||||
alias hfzf='history | fzf'
|
||||
alias phfzf="cat ${PERSISTENT_HISTFILE} | fzf"
|
||||
|
||||
|
||||
#{- NETWORKING -}#
|
||||
|
||||
@@ -46,6 +62,8 @@ alias ping="ping -c 4"
|
||||
# Show progress while syncing
|
||||
alias rsync="rsync --progress"
|
||||
|
||||
# Force a newline at the end of curl responses to prevent artifacting
|
||||
alias curl="curl -w '\n'"
|
||||
|
||||
#{- SHELL INTROSPECTION -}#
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ export HISTSIZE=-1
|
||||
#{- SHELL OPTIONS -}#
|
||||
|
||||
# Append history to $HISTFILE when bash exits, instead of overwriting it
|
||||
shopt -s histappend
|
||||
#shopt -s histappend
|
||||
|
||||
# Attempt to preserve multi-line commands in history with embedded newlines
|
||||
shopt -s cmdhist lithist
|
||||
|
||||
80
bash/.bashrc
80
bash/.bashrc
@@ -2,18 +2,47 @@
|
||||
|
||||
#{- PROMPT -}#
|
||||
|
||||
red="\[\033[1;31m\]"
|
||||
green="\[\033[1;32m\]"
|
||||
yellow="\[\033[1;33m\]"
|
||||
blue="\[\033[1;34m\]"
|
||||
magenta="\[\033[1;35m\]"
|
||||
cyan="\[\033[1;36m\]"
|
||||
no_color="\[\033[0m\]"
|
||||
if which tput &> /dev/null && tput bold &> /dev/null; then
|
||||
red="\001$(tput bold)$(tput setaf 1)\002"
|
||||
green="\001$(tput bold)$(tput setaf 2)\002"
|
||||
yellow="\001$(tput bold)$(tput setaf 3)\002"
|
||||
blue="\001$(tput bold)$(tput setaf 4)\002"
|
||||
magenta="\001$(tput bold)$(tput setaf 5)\002"
|
||||
cyan="\001$(tput bold)$(tput setaf 6)\002"
|
||||
no_color="\001$(tput sgr0)\002"
|
||||
else
|
||||
red="\[\033[1;31m\]"
|
||||
green="\[\033[1;32m\]"
|
||||
yellow="\[\033[1;33m\]"
|
||||
blue="\[\033[1;34m\]"
|
||||
magenta="\[\033[1;35m\]"
|
||||
cyan="\[\033[1;36m\]"
|
||||
no_color="\[\033[0m\]"
|
||||
fi
|
||||
|
||||
export PS1="${green}\$${no_color} "
|
||||
if [ "${HOSTNAME}" != "crypt" ] && [ "${HOSTNAME}" != "tomb" ]; then
|
||||
|
||||
export PS1="${green}"'\$'"${no_color} "
|
||||
export DIRENV_PS1="${red}"'\$'"${no_color} "
|
||||
export NIX_SHELL_PS1="${blue}"'λ'"${no_color} "
|
||||
if [ "${HOSTNAME}" != "crypt" ] && [ "${HOSTNAME}" != "tomb" ] || [ "${SSH_TTY}" != "" ]; then
|
||||
DIRENV_PS1="${DIRENV_PS1}${blue}${HOSTNAME} ${DIRENV_PS1}"
|
||||
NIX_SHELL_PS1="${NIX_SHELL_PS1}${green}${HOSTNAME} ${NIX_SHELL_PS1}"
|
||||
PS1="${PS1}${blue}${HOSTNAME} ${PS1}"
|
||||
fi
|
||||
export ORIG_PS1=${PS1}
|
||||
|
||||
if which direnv &> /dev/null; then
|
||||
update_prompt() {
|
||||
if [ -n "${IN_NIX_SHELL}" ]; then
|
||||
PS1=${NIX_SHELL_PS1}
|
||||
elif direnv status | grep -iEq 'RC allowed (true|0)'; then
|
||||
PS1=${DIRENV_PS1}
|
||||
else
|
||||
PS1=${ORIG_PS1}
|
||||
fi
|
||||
}
|
||||
PROMPT_COMMAND="update_prompt; $PROMPT_COMMAND"
|
||||
fi
|
||||
|
||||
# Continuation Prompt: "> " in cyan
|
||||
export PS2="${cyan}>${no_color} "
|
||||
@@ -22,12 +51,35 @@ export PS4="${blue}#${no_color} "
|
||||
|
||||
#{- HISTORY -}#
|
||||
|
||||
#shopt -s histappend
|
||||
#export PROMPT_COMMAND="history -a; histroy -c; history -r; $PROMPT_COMMAND"
|
||||
PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
|
||||
# PROMPT_COMMAND="echo hist1; history; history -n; echo hist2; history; history -w; echo hist3; history; history -c; echo hist4; history; history -r; echo hist5; history; $PROMPT_COMMAND"
|
||||
export HISTFILE="$HOME/.history/bash"
|
||||
export HISTTIMEFORMAT="%F %T "
|
||||
export HISTCONTROL="erasedups:ignoreboth"
|
||||
export HISTFILESIZE=-1
|
||||
export HISTSIZE=-1
|
||||
|
||||
export HISTCONTROL="ignoreboth:erasedups"
|
||||
shopt -s histappend
|
||||
export PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
|
||||
export PERSISTENT_HISTFILE="${HOME}/.history/bash_persistent_history"
|
||||
log_bash_persistent_history()
|
||||
{
|
||||
local rc=$?
|
||||
[[
|
||||
$(history 1) =~ ^\ *[0-9]+\ +([^\ ]+\ [^\ ]+)\ +(.*)$
|
||||
]]
|
||||
local date_part="${BASH_REMATCH[1]}"
|
||||
local command_part="${BASH_REMATCH[2]}"
|
||||
# Ensure file exists
|
||||
if ! [ -w "$(dirname ${PERSISTENT_HISTFILE})" ]; then
|
||||
mkdir -p $(dirname ${PERSISTENT_HISTFILE})
|
||||
fi
|
||||
if [ "$command_part" != "$PERSISTENT_HISTORY_LAST" ]
|
||||
then
|
||||
echo $date_part "|" "$rc" "|" "$command_part" >> "${PERSISTENT_HISTFILE}"
|
||||
export PERSISTENT_HISTORY_LAST="$command_part"
|
||||
fi
|
||||
}
|
||||
|
||||
PROMPT_COMMAND="log_bash_persistent_history; $PROMPT_COMMAND"
|
||||
|
||||
|
||||
#{- SOURCING -}#
|
||||
|
||||
@@ -15,3 +15,9 @@ maths()
|
||||
{
|
||||
bc -l <<< "scale=2; $*"
|
||||
}
|
||||
|
||||
cat_with_newline()
|
||||
{
|
||||
cat "$@" && echo
|
||||
}
|
||||
alias cat="cat_with_newline"
|
||||
|
||||
1
gnupg/.gnupg/gpg-agent.conf
Normal file
1
gnupg/.gnupg/gpg-agent.conf
Normal file
@@ -0,0 +1 @@
|
||||
pinentry-program /home/coder/.nix-profile/bin/pinentry-curses
|
||||
45
install.sh
Executable file
45
install.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install my dotfiles on a variety of systems
|
||||
|
||||
set -ex
|
||||
|
||||
echo "PWD: $PWD"
|
||||
# Coder dotfiles (and most other ways of doing this) will not do a recursive clone, so do that in install script.
|
||||
git submodule init && git submodule update
|
||||
# Match case insensitively to make things easier for this part
|
||||
shopt -s nocasematch
|
||||
|
||||
echo "Installing dotfiles..."
|
||||
if [ -f /etc/os-release ]; then
|
||||
echo "Idenitfying OS to install GNU stow..."
|
||||
if [ "${CODER_OS_FAMILY:-}" == "Ubuntu" ] || grep -q -i debian /etc/os-release; then
|
||||
echo "Detected OS as Ubuntu, using apt";
|
||||
sudo apt-get update;
|
||||
sudo apt-get install -y stow;
|
||||
installers/install-nix.sh
|
||||
elif grep -q -i rhel /etc/os-release || grep -q -i fedora /etc/os-release; then
|
||||
echo "You've got RedHat (or maybe Fedora)! Which is unsupported right now sorry!";
|
||||
# sudo yum install -y stow;
|
||||
# sudo yum clean all;
|
||||
exit 1
|
||||
elif grep -q -i alpine /etc/os-release; then
|
||||
echo "You've got Alpine! Which is unsupported right now sorry!";
|
||||
exit 1;
|
||||
# apk add --no-cache jq curl;
|
||||
else
|
||||
echo "ERROR: Unable to identify OS!" 1>&2;
|
||||
exit 1;
|
||||
fi;
|
||||
else
|
||||
if [ "${CODER_TEMPLATE_TYPE}" == "Devcontainer" ]; then
|
||||
installers/install-nix.sh
|
||||
fi
|
||||
echo "ERROR: Unable to find '/etc/os-release' information!" 1>&2;
|
||||
exit 1;
|
||||
fi
|
||||
shopt -u nocasematch
|
||||
|
||||
# Apply the dotfiles with stow
|
||||
echo "Running apply dotfiles"
|
||||
./apply-dotfiles
|
||||
echo "Dotfiles applied successfully"
|
||||
126
installers/install-nix-packages-flake.sh
Executable file
126
installers/install-nix-packages-flake.sh
Executable file
@@ -0,0 +1,126 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installs packages to the nix profile using nix profile
|
||||
# Reference: https://nixos.org/manual/nixpkgs/stable/#sec-declarative-package-management
|
||||
|
||||
set -ex
|
||||
|
||||
nix_packages=(
|
||||
# Personal tools
|
||||
"vimHugeX"
|
||||
"ranger"
|
||||
"jq"
|
||||
"yq"
|
||||
|
||||
"ruby"
|
||||
"shellcheck"
|
||||
|
||||
# Neovim + Plugin dependencies
|
||||
"neovim"
|
||||
"ripgrep"
|
||||
"fzf"
|
||||
|
||||
# Language servers
|
||||
"helm-ls" # Helm
|
||||
"yaml-language-server" # Yaml
|
||||
"lua-language-server" # Lua
|
||||
"solargraph" # Ruby
|
||||
|
||||
# ProgrammingLanguages
|
||||
"lua52Packages.lua"
|
||||
|
||||
"pass"
|
||||
"gnupg"
|
||||
"gnupg1"
|
||||
"pinentry-curses"
|
||||
|
||||
# Professional tools
|
||||
"skopeo"
|
||||
"awscli2"
|
||||
|
||||
"kubectl"
|
||||
"kubernetes-helm"
|
||||
"rancher"
|
||||
|
||||
# Remote programming tools
|
||||
"lemonade"
|
||||
)
|
||||
unstable_packages=(
|
||||
# CVE in NixOS stable version of vault
|
||||
"vault"
|
||||
|
||||
# Need unstable latest up to date terraform/terragrunt
|
||||
"terraform"
|
||||
"terragrunt"
|
||||
|
||||
# Language servers
|
||||
"gitlab-ci-ls"
|
||||
)
|
||||
|
||||
|
||||
mkdir -p ~/.config/nixpkgs/
|
||||
templated_insert="$(for nix_package in ${nix_packages[@]}; do echo " $nix_package"; echo; done)"
|
||||
templated_insert=${templated_insert}$(for unstable_package in ${unstable_packages[@]}; do echo; echo " unstablePkgs.$unstable_package"; done)
|
||||
|
||||
|
||||
# Reference: https://discourse.nixos.org/t/nix-profile-in-combination-with-declarative-package-management/21228/9
|
||||
cat << EOF > ~/.config/nixpkgs/flake.nix
|
||||
{
|
||||
description = "A declarative system installation";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, unstable }:
|
||||
let
|
||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||
|
||||
# Generate a user-friendly version number.
|
||||
version = builtins.substring 0 8 self.lastModifiedDate;
|
||||
|
||||
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
|
||||
# Nixpkgs instantiated for supported system types.
|
||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; config.allowUnfree = true; });
|
||||
in {
|
||||
packages = forAllSystems (system:
|
||||
let
|
||||
pkgs = nixpkgsFor.\${system};
|
||||
in {
|
||||
default = self.packages.\${system}.myPackageCollection;
|
||||
myPackageCollection = # libs and clis
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.\${system}; # here we need just legacy packages
|
||||
unstablePkgs = import unstable { inherit system; config.allowUnfree = true; };
|
||||
in pkgs.buildEnv {
|
||||
name = "myPackages";
|
||||
paths = with pkgs; [
|
||||
${templated_insert}
|
||||
];
|
||||
|
||||
extraOutputsToInstall = [ "man" "doc" ];
|
||||
};
|
||||
}); # packages
|
||||
}; # outputs
|
||||
}
|
||||
EOF
|
||||
|
||||
install_nix_packages()
|
||||
{
|
||||
# The name of the package we are going to install, needed to check for presence/uninstall
|
||||
package_name=packages.x86_64-linux.myPackageCollection
|
||||
if [ "${nix_packages[*]}" ]; then
|
||||
# Updated to process new nix profile format, proper processing probably needs JQ
|
||||
# But JQ would be another dependency and this is good enough for now
|
||||
if nix profile list --json | grep -i "\"attrPath\":\"${package_name}\""; then
|
||||
echo "Removing previous version of profile"
|
||||
nix profile remove "${package_name}"
|
||||
fi
|
||||
echo "Installing profile"
|
||||
nix profile install "${HOME}/.config/nixpkgs/flake.nix#myPackageCollection"
|
||||
fi
|
||||
}
|
||||
|
||||
install_nix_packages
|
||||
47
installers/install-nix.sh
Executable file
47
installers/install-nix.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Install the Nix package manager as a secondary package manager.
|
||||
# This can sometimes be useful for getting more recent packages.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Abort installation if Nix is already installed
|
||||
if [ -d /nix ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Workaround to make a single user install work as root
|
||||
if [ "${USER:-}" == "root" ] || [ "${UID:-}" == "0" ]; then
|
||||
mkdir -p /etc/nix
|
||||
echo "build-users-group =" > /etc/nix/nix.conf
|
||||
fi
|
||||
|
||||
# Download the Nix installer and it's signature from NixOS.org
|
||||
curl -so install-nix https://releases.nixos.org/nix/nix-2.18.7/install
|
||||
|
||||
# Run the installer
|
||||
sh ./install-nix
|
||||
|
||||
# Source the nix profile
|
||||
cat << EOF > ~/.bashrc
|
||||
# Source nix if it's installed
|
||||
if [ -r ~/.nix-profile/etc/profile.d/nix.sh ]; then
|
||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
||||
fi
|
||||
EOF
|
||||
|
||||
# Remove the installer and signature
|
||||
rm -f ./install-nix
|
||||
|
||||
# Enable flakes and the nix command
|
||||
NIX_CONF_DIR=~/.config/nix
|
||||
NIX_CONF_FILE=${NIX_CONF_DIR}/nix.conf
|
||||
mkdir -p ${NIX_CONF_DIR}
|
||||
cat <<EOF > ${NIX_CONF_FILE}
|
||||
experimental-features = flakes nix-command
|
||||
EOF
|
||||
# Conditionally add a link to system certificates for nix
|
||||
if [ -f /etc/ssl/certs/ca-certificates.crt ]; then
|
||||
echo 'ssl-cert-file = /etc/ssl/certs/ca-certificates.crt' >> ${NIX_CONF_FILE}
|
||||
fi
|
||||
7
nix-install
Executable file
7
nix-install
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -p stow envsubst -i bash
|
||||
|
||||
# Uses nix shell to setup the dotfiles
|
||||
./apply-dotfiles
|
||||
# Secret dotfiles need interactivity anyways, not worrying about this for now
|
||||
# ./apply-secret-dotfiles
|
||||
@@ -74,3 +74,10 @@ set keymap vi-insert
|
||||
Control-q: quoted-insert
|
||||
Control-@: set-mark
|
||||
Control-_: undo
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
set keymap vi-command
|
||||
j: history-search-forward
|
||||
k: history-search-backward
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
|
||||
12
screen/.screenrc
Normal file
12
screen/.screenrc
Normal file
@@ -0,0 +1,12 @@
|
||||
# Extend scrollback buffer
|
||||
defscrollback 100000
|
||||
# Disable startup message
|
||||
startup_message off
|
||||
|
||||
# Do not lock the screen
|
||||
bind x
|
||||
bind ^x
|
||||
|
||||
# Do not write a copy of screen out to disk
|
||||
bind h
|
||||
bind ^h
|
||||
@@ -22,6 +22,9 @@ export LC_COLLATE="C"
|
||||
export EDITOR="vim"
|
||||
export VISUAL="vim"
|
||||
|
||||
# Export browser preferences.
|
||||
export BROWSER="firefox"
|
||||
|
||||
# Export pager preferences.
|
||||
export PAGER="less"
|
||||
export LESSHISTFILE="-"
|
||||
|
||||
@@ -1 +1 @@
|
||||
EnableEscapeCommandline yes
|
||||
Include ~/.ssh/extra.conf
|
||||
|
||||
24
vim/.config/nvim/init.vim
Normal file
24
vim/.config/nvim/init.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||
let &packpath = &runtimepath
|
||||
source ~/.vimrc
|
||||
|
||||
lua <<EOF
|
||||
vim.g.mapleader = ','
|
||||
|
||||
require('user.lspconfig')
|
||||
require('user.indentblanklines')
|
||||
require('user.luasnip')
|
||||
|
||||
EOF
|
||||
|
||||
nnoremap <leader>ib <cmd>IBLToggle<cr>
|
||||
|
||||
" Beginner keybinds for telescope
|
||||
nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
||||
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
||||
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
||||
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
||||
|
||||
" lua print('this also works')
|
||||
|
||||
command! LuaRuntimePath lua print(vim.inspect(vim.api.nvim_list_runtime_paths()))
|
||||
8
vim/.config/nvim/lua/user/indentblanklines.lua
Normal file
8
vim/.config/nvim/lua/user/indentblanklines.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Configure the 'indent-blankline' plugin
|
||||
-- Look at configuring this for rainbow blocks at some point
|
||||
require('ibl').setup{
|
||||
enabled = false,
|
||||
indent = {
|
||||
char = '|'
|
||||
}
|
||||
}
|
||||
85
vim/.config/nvim/lua/user/lspconfig.lua
Normal file
85
vim/.config/nvim/lua/user/lspconfig.lua
Normal file
@@ -0,0 +1,85 @@
|
||||
print('User LSP Configuration loaded')
|
||||
local lsp = require('lspconfig')
|
||||
|
||||
-- Configure LuaLS for lua
|
||||
lsp.lua_ls.setup{
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then
|
||||
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
-- "${3rd}/luv/library"
|
||||
-- "${3rd}/busted/library",
|
||||
}
|
||||
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
||||
-- library = vim.api.nvim_get_runtime_file("", true)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
||||
end
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
lsp.pylsp.setup{}
|
||||
lsp.solargraph.setup{}
|
||||
|
||||
|
||||
-- Setup LSP bindings
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
desc = 'LSP actions',
|
||||
callback = function()
|
||||
local bufmap = function(mode, lhs, rhs)
|
||||
local opts = {buffer = true}
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
|
||||
-- Displays hover information about the symbol under the cursor
|
||||
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
|
||||
|
||||
-- Jump to the definition
|
||||
bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>')
|
||||
|
||||
-- Jump to declaration
|
||||
bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
|
||||
|
||||
-- Lists all the implementations for the symbol under the cursor
|
||||
bufmap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>')
|
||||
|
||||
-- Jumps to the definition of the type symbol
|
||||
bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
|
||||
|
||||
-- Lists all the references
|
||||
bufmap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>')
|
||||
|
||||
-- Displays a function's signature information
|
||||
bufmap('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
|
||||
|
||||
-- Renames all references to the symbol under the cursor
|
||||
bufmap('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>')
|
||||
|
||||
-- Selects a code action available at the current cursor position
|
||||
bufmap('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>')
|
||||
|
||||
-- Show diagnostics in a floating window
|
||||
bufmap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>')
|
||||
|
||||
-- Move to the previous diagnostic
|
||||
bufmap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
|
||||
|
||||
-- Move to the next diagnostic
|
||||
bufmap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
|
||||
end
|
||||
})
|
||||
98
vim/.config/nvim/lua/user/luasnip.lua
Normal file
98
vim/.config/nvim/lua/user/luasnip.lua
Normal file
@@ -0,0 +1,98 @@
|
||||
local ls = require("luasnip")
|
||||
|
||||
local fmt = require('luasnip.extras.fmt')
|
||||
local rep = require('luasnip.extras').rep
|
||||
|
||||
-- some shorthands...
|
||||
-- Taken from video/guide. Honestly I don't like these should probably work on learning their names
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local l = require("luasnip.extras").lambda
|
||||
local rep = require("luasnip.extras").rep
|
||||
local p = require("luasnip.extras").partial
|
||||
local m = require("luasnip.extras").match
|
||||
local n = require("luasnip.extras").nonempty
|
||||
local dl = require("luasnip.extras").dynamic_lambda
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local types = require("luasnip.util.types")
|
||||
local conds = require("luasnip.extras.conditions")
|
||||
local conds_expand = require("luasnip.extras.conditions.expand")
|
||||
|
||||
ls.config.set_config {
|
||||
history = true,
|
||||
|
||||
-- This allows dynamic snippets to update as you type
|
||||
updateevents = "TextChanged,TextChangedI"
|
||||
}
|
||||
|
||||
-- Expand if expandable, or jump forward if jumpable
|
||||
-- If neither, do nothing queitly
|
||||
-- vim.keymap.set({ "i", "s" }, "<C-K>", function()
|
||||
vim.keymap.set({ "i", "s" }, "<Tab>", function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end, { silent = true })
|
||||
-- end, { silent = true })
|
||||
|
||||
-- Jump backwards to the previous jumpable point
|
||||
-- vim.keymap.set({ "i", "s" }, "<C-J>", function()
|
||||
vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
-- Selecting from a list of options in a choice node
|
||||
-- vim.keymap.set({ "i" }, "<C-L>", function()
|
||||
vim.keymap.set({ "i" }, "<A-Tab>", function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Allow us to hot reload snippets by unloading snippets then resourcing file
|
||||
local ls_cleanup = function()
|
||||
ls.cleanup()
|
||||
vim.cmd("source ~/.config/nvim/lua/user/luasnip.lua")
|
||||
end
|
||||
vim.keymap.set("n", "<leader><leader>s", ls_cleanup)
|
||||
|
||||
ls.add_snippets(nil, {
|
||||
terraform = {
|
||||
ls.parser.parse_snippet("res", "resource \"$1\" \"$2\" {\n $3\n}"),
|
||||
ls.parser.parse_snippet("dat", "data \"$1\" \"$2\" {\n $3\n}"),
|
||||
ls.parser.parse_snippet("var", "variable \"$1\" {\n type = $2\n description = $3\n}"),
|
||||
ls.parser.parse_snippet("loc", "locals {\n $1\n}"),
|
||||
ls.parser.parse_snippet("mod", "module {\n source = $1\n}"),
|
||||
},
|
||||
lua = {
|
||||
ls.parser.parse_snippet("expand", "-- this is what was expanded!"),
|
||||
ls.parser.parse_snippet("lf", "local $1 = function($2)\n $0\nend"),
|
||||
ls.parser.parse_snippet("mf", "$1.$2 = function($3)\n $0\nend"),
|
||||
-- Example from snippet writing guide: https://github.com/L3MON4D3/LuaSnip/blob/master/Examples/snippets.lua#L190
|
||||
s(
|
||||
"fmt1",
|
||||
fmt("To {title} {} {}.", {
|
||||
i(2, "Name"),
|
||||
i(3, "Surname"),
|
||||
title = c(1, { t("Mr."), t("Ms.") }),
|
||||
})
|
||||
),
|
||||
-- Example from video: https://www.youtube.com/watch?v=Dn800rlPIho
|
||||
s(
|
||||
"req",
|
||||
fmt("local {} = require('{}')", {
|
||||
i(1, "default"),
|
||||
rep(1)
|
||||
})
|
||||
),
|
||||
}
|
||||
})
|
||||
Submodule vim/.vim/bundle/ale updated: fdadaed2ba...6db58b3379
Submodule vim/.vim/bundle/commentary updated: 627308e306...c4b8f52cbb
Submodule vim/.vim/bundle/eunuch updated: 7a48f9ff0e...8fb3904be2
Submodule vim/.vim/bundle/filetype-nix updated: 63b47b39c8...e25cd0f2e5
Submodule vim/.vim/bundle/fugitive updated: 2064312ad7...dac8e5c2d8
Submodule vim/.vim/bundle/pathogen updated: e0a3efbda5...ac4dd9494f
Submodule vim/.vim/bundle/sleuth updated: 228e51160c...1cc4557420
Submodule vim/.vim/bundle/slime updated: a81139239d...87988b173b
Submodule vim/.vim/bundle/supertab updated: 40fe711e08...f0093ae12a
Submodule vim/.vim/bundle/tagbar updated: 56399f446c...12edcb5944
Submodule vim/.vim/bundle/vim-terraform updated: f0b17ac9f1...21f756b933
Submodule vim/.vim/bundle/vinegar updated: fcce70f140...bb1bcddf43
@@ -53,7 +53,7 @@ exe "let s:bg_white = ' ctermbg=".s:white"'"
|
||||
exe "let s:fg_none = ' ctermfg=NONE'"
|
||||
exe "let s:fg_default = ' ctermfg=".s:foreground"'"
|
||||
exe "let s:fg_black = ' ctermfg=".s:black"'"
|
||||
exe "let s:fg_red = ' ctermfg=".s:red"'"
|
||||
exe "let s:fg_red = ' ctermfg=".s:bright_red"'"
|
||||
exe "let s:fg_green = ' ctermfg=".s:green"'"
|
||||
exe "let s:fg_yellow = ' ctermfg=".s:yellow"'"
|
||||
exe "let s:fg_blue = ' ctermfg=".s:blue"'"
|
||||
@@ -135,20 +135,27 @@ exe "hi! Todo" .s:fmt_bold .s:fg_magenta.s:bg_none
|
||||
" *Todo anything that needs extra attention; mostly the
|
||||
" keywords TODO FIXME and XXX
|
||||
|
||||
exe "hi! StatusLine" .s:fg_dark_grey .s:bg_bright_red
|
||||
exe "hi! StatusLineNC" .s:fg_dark_grey .s:bg_bright_magenta
|
||||
exe "hi! StatusLine" .s:fg_blue .s:bg_none
|
||||
exe "hi! StatusLineNC" .s:fg_blue .s:bg_none
|
||||
|
||||
exe "hi! LineNr" .s:fg_dark_grey .s:bg_none
|
||||
exe "hi! CursorLineNr" .s:fg_bright_magenta .s:bg_none
|
||||
|
||||
exe "hi! TabLine" .s:fmt_none .s:fg_bright_red .s:bg_dark_grey
|
||||
exe "hi! TabLineSel" .s:fmt_none .s:fg_bright_magenta .s:bg_dark_grey
|
||||
exe "hi! TabLineFill" .s:fmt_none .s:fg_none .s:bg_dark_grey
|
||||
exe "hi! TabLine" .s:fmt_none .s:fg_black .s:bg_blue
|
||||
exe "hi! TabLineSel" .s:fmt_bold .s:fg_black .s:bg_cyan
|
||||
exe "hi! TabLineFill" .s:fmt_none .s:fg_none .s:bg_bright_blue
|
||||
|
||||
exe "hi! CursorLine" .s:fmt_none .s:bg_dark_grey
|
||||
exe "hi! CursorColumn" .s:fmt_none .s:bg_dark_grey
|
||||
exe "hi! CursorLine" .s:fmt_none .s:bg_blue
|
||||
exe "hi! CursorColumn" .s:fmt_none .s:bg_blue
|
||||
|
||||
exe "hi! VertSplit" .s:fg_dark_grey .s:bg_dark_grey
|
||||
exe "hi! VertSplit" .s:fg_blue .s:bg_blue
|
||||
|
||||
"{- This entire section was trying to troubleshoot why LSP popups where
|
||||
"{- showing up with red on pink text.
|
||||
exe "hi! Pmenu" .s:fg_default .s:bg_black
|
||||
exe "hi! PmenuSel" .s:fg_black .s:bg_white
|
||||
exe "hi! PmenuSbar" .s:fg_default .s:bg_black
|
||||
exe "hi! PmenuThumb" .s:fg_default .s:bg_black
|
||||
|
||||
"if &background == "light"
|
||||
" highlight Normal ctermfg=0 ctermbg=15
|
||||
|
||||
1
vim/.vim/nvim-bundle/LuaSnip
Submodule
1
vim/.vim/nvim-bundle/LuaSnip
Submodule
Submodule vim/.vim/nvim-bundle/LuaSnip added at 8ae1dedd98
1
vim/.vim/nvim-bundle/indent-blankline
Submodule
1
vim/.vim/nvim-bundle/indent-blankline
Submodule
Submodule vim/.vim/nvim-bundle/indent-blankline added at 3d08501cae
1
vim/.vim/nvim-bundle/nvim-lspconfig
Submodule
1
vim/.vim/nvim-bundle/nvim-lspconfig
Submodule
Submodule vim/.vim/nvim-bundle/nvim-lspconfig added at e25c4cdecd
1
vim/.vim/nvim-bundle/plenary
Submodule
1
vim/.vim/nvim-bundle/plenary
Submodule
Submodule vim/.vim/nvim-bundle/plenary added at 8aad439684
1
vim/.vim/nvim-bundle/telescope
Submodule
1
vim/.vim/nvim-bundle/telescope
Submodule
Submodule vim/.vim/nvim-bundle/telescope added at 5a701e9990
30
vim/.vimrc
30
vim/.vimrc
@@ -6,7 +6,7 @@ set nocompatible
|
||||
"{- PLUGIN MANAGER -}"
|
||||
" Load pathogen, the plugin manager, which then loads all plugins "
|
||||
runtime bundle/pathogen/autoload/pathogen.vim
|
||||
execute pathogen#infect()
|
||||
execute pathogen#infect('bundle/{}', 'nvim-bundle/{}')
|
||||
|
||||
"{- COMMANDS -}"
|
||||
|
||||
@@ -31,7 +31,7 @@ set nocompatible
|
||||
"{- INTERFACE -}"
|
||||
|
||||
" Colors and syntax highlighting "
|
||||
colorscheme dim
|
||||
colorscheme halfdab
|
||||
set background=dark
|
||||
filetype plugin on
|
||||
syntax on
|
||||
@@ -103,7 +103,8 @@ set nocompatible
|
||||
set complete+=kspell
|
||||
|
||||
" Match the longest completion option then display menu
|
||||
set completeopt=menuone,longest
|
||||
"set completeopt=menuone,longest
|
||||
set completeopt=menu,menuone,noselect
|
||||
|
||||
" Use UTF-8 "
|
||||
set encoding=utf-8
|
||||
@@ -118,7 +119,11 @@ set nocompatible
|
||||
set spelllang=en_us,cjk
|
||||
|
||||
" Store the viminfo file in the .vim directory "
|
||||
set viminfo+=n$HOME/.vim/.viminfo
|
||||
if !has('nvim')
|
||||
set viminfo+=n$HOME/.vim/.viminfo
|
||||
else
|
||||
set viminfo+=n$HOME/.vim/.shada
|
||||
endif
|
||||
|
||||
" Don't use a pager "
|
||||
set nomore
|
||||
@@ -128,6 +133,19 @@ set nocompatible
|
||||
set clipboard=unnamed,unnamedplus
|
||||
endif
|
||||
|
||||
"{- AUTOCOMMANDS -}"
|
||||
|
||||
" Wrap lines for markdown files by default
|
||||
augroup mdwrap
|
||||
autocmd BufReadPost *.md :set wrap
|
||||
augroup END
|
||||
|
||||
" Automatically go to the last line for log files
|
||||
augroup logend
|
||||
autocmd BufReadPost *.log normal G
|
||||
autocmd BufReadPost *.logs normal G
|
||||
augroup END
|
||||
|
||||
"{- PLUGINS -}"
|
||||
|
||||
"{- SLIME -}"
|
||||
@@ -138,7 +156,8 @@ set nocompatible
|
||||
let g:slime_paste_file = tempname()
|
||||
|
||||
" Default session for screen
|
||||
let g:slime_default_config = {"sessionname": "REPL", "windowname": ""}
|
||||
let sessionname = v:version >= 801 ? trim(system("echo $STY | cut -d. -f2")) : "default"
|
||||
let g:slime_default_config = {"sessionname": sessionname, "windowname": "repl"}
|
||||
|
||||
"{- SUPERTAB -}"
|
||||
" Use the default vim completion keys for supertab completion
|
||||
@@ -190,4 +209,3 @@ set nocompatible
|
||||
\ 'type' : 't'
|
||||
\ }
|
||||
\ }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user